diff options
author | Robert Adams | 2013-08-08 13:53:12 -0700 |
---|---|---|
committer | Robert Adams | 2013-08-08 13:55:17 -0700 |
commit | 6410a25cefcb1e7f87b76f273f8c6569fbe17670 (patch) | |
tree | 29dbaa0d610d8eb7c79ac3871ece5119d53a9f2c /OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |
parent | Make m_originRegionID in ScenePresence public to allow DSG module to work for... (diff) | |
download | opensim-SC-6410a25cefcb1e7f87b76f273f8c6569fbe17670.zip opensim-SC-6410a25cefcb1e7f87b76f273f8c6569fbe17670.tar.gz opensim-SC-6410a25cefcb1e7f87b76f273f8c6569fbe17670.tar.bz2 opensim-SC-6410a25cefcb1e7f87b76f273f8c6569fbe17670.tar.xz |
BulletSim: adjust avatar position when the avatar's size is changed.
This fixes the problem of avatars bouncing when logged in.
Added a little height to the avatar height fudges to eliminate a problem
of feet being in the ground a bit.
Diffstat (limited to '')
-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 | } |