diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 58a417e..9af3dce 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -96,8 +96,8 @@ public sealed class BSCharacter : BSPhysObject | |||
96 | m_moveActor = new BSActorAvatarMove(PhysScene, this, AvatarMoveActorName); | 96 | m_moveActor = new BSActorAvatarMove(PhysScene, this, AvatarMoveActorName); |
97 | PhysicalActors.Add(AvatarMoveActorName, m_moveActor); | 97 | PhysicalActors.Add(AvatarMoveActorName, m_moveActor); |
98 | 98 | ||
99 | DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}", | 99 | DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6}", |
100 | LocalID, _size, Scale, Density, _avatarVolume, RawMass); | 100 | LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos); |
101 | 101 | ||
102 | // do actual creation in taint time | 102 | // do actual creation in taint time |
103 | PhysScene.TaintedObject("BSCharacter.create", delegate() | 103 | PhysScene.TaintedObject("BSCharacter.create", delegate() |
@@ -190,6 +190,10 @@ public sealed class BSCharacter : BSPhysObject | |||
190 | } | 190 | } |
191 | 191 | ||
192 | set { | 192 | set { |
193 | // This is how much the avatar size is changing. Positive means getting bigger. | ||
194 | // The avatar altitude must be adjusted for this change. | ||
195 | float heightChange = value.Z - _size.Z; | ||
196 | |||
193 | _size = value; | 197 | _size = value; |
194 | // Old versions of ScenePresence passed only the height. If width and/or depth are zero, | 198 | // Old versions of ScenePresence passed only the height. If width and/or depth are zero, |
195 | // replace with the default values. | 199 | // replace with the default values. |
@@ -207,6 +211,10 @@ public sealed class BSCharacter : BSPhysObject | |||
207 | { | 211 | { |
208 | PhysScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale); | 212 | PhysScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale); |
209 | UpdatePhysicalMassProperties(RawMass, true); | 213 | UpdatePhysicalMassProperties(RawMass, true); |
214 | |||
215 | // Adjust the avatar's position to account for the increase/decrease in size | ||
216 | ForcePosition = new OMV.Vector3(RawPosition.X, RawPosition.Y, RawPosition.Z + heightChange / 2f); | ||
217 | |||
210 | // Make sure this change appears as a property update event | 218 | // Make sure this change appears as a property update event |
211 | PhysScene.PE.PushUpdate(PhysBody); | 219 | PhysScene.PE.PushUpdate(PhysBody); |
212 | } | 220 | } |