diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs index 0191893..12ffacb 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs | |||
@@ -187,12 +187,25 @@ public class BSActorAvatarMove : BSActor | |||
187 | 187 | ||
188 | if (m_controllingPrim.IsColliding) | 188 | if (m_controllingPrim.IsColliding) |
189 | { | 189 | { |
190 | // If we are colliding with a stationary object, presume we're standing and don't move around | 190 | // if colliding with something stationary and we're not doing volume detect . |
191 | if (!m_controllingPrim.ColliderIsMoving && !m_controllingPrim.ColliderIsVolumeDetect) | 191 | if (!m_controllingPrim.ColliderIsMoving && !m_controllingPrim.ColliderIsVolumeDetect) |
192 | { | 192 | { |
193 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", m_controllingPrim.LocalID); | 193 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,totalForce={1}, vel={2}", /* DEBUG */ |
194 | m_controllingPrim.IsStationary = true; | 194 | m_controllingPrim.LocalID, m_physicsScene.PE.GetTotalForce(m_controllingPrim.PhysBody), m_controllingPrim.Velocity); /* DEBUG */ |
195 | m_controllingPrim.ZeroMotion(true /* inTaintTime */); | 195 | // If velocity is very small, assume it is movement creep and suppress it. |
196 | // Applying push forces (Character.AddForce) should move the avatar and that is only seen here as velocity. | ||
197 | if ( (m_controllingPrim.Velocity.LengthSquared() < BSParam.AvatarStopZeroThresholdSquared) | ||
198 | && (m_physicsScene.PE.GetTotalForce(m_controllingPrim.PhysBody).LengthSquared() < BSParam.AvatarStopZeroThresholdSquared) ) | ||
199 | { | ||
200 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", m_controllingPrim.LocalID); | ||
201 | m_controllingPrim.IsStationary = true; | ||
202 | m_controllingPrim.ZeroMotion(true /* inTaintTime */); | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,not zeroing because velocity={1}", | ||
207 | m_controllingPrim.LocalID, m_controllingPrim.Velocity); | ||
208 | } | ||
196 | } | 209 | } |
197 | 210 | ||
198 | // Standing has more friction on the ground | 211 | // Standing has more friction on the ground |
@@ -222,8 +235,8 @@ public class BSActorAvatarMove : BSActor | |||
222 | } | 235 | } |
223 | } | 236 | } |
224 | 237 | ||
225 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2}", | 238 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2},isStationary={3}", |
226 | m_controllingPrim.LocalID, m_velocityMotor.TargetValue, m_controllingPrim.IsColliding); | 239 | m_controllingPrim.LocalID, m_velocityMotor.TargetValue, m_controllingPrim.IsColliding,m_controllingPrim.IsStationary); |
227 | } | 240 | } |
228 | else | 241 | else |
229 | { | 242 | { |
@@ -237,6 +250,8 @@ public class BSActorAvatarMove : BSActor | |||
237 | m_physicsScene.PE.SetFriction(m_controllingPrim.PhysBody, m_controllingPrim.Friction); | 250 | m_physicsScene.PE.SetFriction(m_controllingPrim.PhysBody, m_controllingPrim.Friction); |
238 | } | 251 | } |
239 | 252 | ||
253 | // If not flying and not colliding, assume falling and keep the downward motion component. | ||
254 | // This check is done here for the next jump test. | ||
240 | if (!m_controllingPrim.Flying && !m_controllingPrim.IsColliding) | 255 | if (!m_controllingPrim.Flying && !m_controllingPrim.IsColliding) |
241 | { | 256 | { |
242 | stepVelocity.Z = m_controllingPrim.RawVelocity.Z; | 257 | stepVelocity.Z = m_controllingPrim.RawVelocity.Z; |
@@ -267,11 +282,9 @@ public class BSActorAvatarMove : BSActor | |||
267 | } | 282 | } |
268 | else | 283 | else |
269 | { | 284 | { |
270 | |||
271 | // Since we're not affected by anything, the avatar must be falling and we do not want that to be too fast. | 285 | // Since we're not affected by anything, the avatar must be falling and we do not want that to be too fast. |
272 | if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity) | 286 | if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity) |
273 | { | 287 | { |
274 | |||
275 | stepVelocity.Z = BSParam.AvatarTerminalVelocity; | 288 | stepVelocity.Z = BSParam.AvatarTerminalVelocity; |
276 | } | 289 | } |
277 | else | 290 | else |
@@ -315,7 +328,11 @@ public class BSActorAvatarMove : BSActor | |||
315 | if (m_controllingPrim.IsStationary) | 328 | if (m_controllingPrim.IsStationary) |
316 | { | 329 | { |
317 | entprop.Position = m_controllingPrim.RawPosition; | 330 | entprop.Position = m_controllingPrim.RawPosition; |
318 | entprop.Velocity = OMV.Vector3.Zero; | 331 | // Suppress small movement velocity |
332 | if (entprop.Velocity.LengthSquared() < BSParam.AvatarStopZeroThresholdSquared) { | ||
333 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,OnPreUpdate,zeroing velocity={1}", m_controllingPrim.LocalID, entprop.Velocity); | ||
334 | entprop.Velocity = OMV.Vector3.Zero; | ||
335 | } | ||
319 | m_physicsScene.PE.SetTranslation(m_controllingPrim.PhysBody, entprop.Position, entprop.Rotation); | 336 | m_physicsScene.PE.SetTranslation(m_controllingPrim.PhysBody, entprop.Position, entprop.Rotation); |
320 | } | 337 | } |
321 | 338 | ||