diff options
author | Robert Adams | 2015-01-07 06:39:29 -0800 |
---|---|---|
committer | Robert Adams | 2015-01-07 06:39:29 -0800 |
commit | 700543b161f653ea41faf3d125a1eb9be389ec23 (patch) | |
tree | 719c9f864ecbeb5ee5f1cbaece208d440946a6f7 /OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | |
parent | Donation of robust network connectors for estate service, as promised. This a... (diff) | |
download | opensim-SC_OLD-700543b161f653ea41faf3d125a1eb9be389ec23.zip opensim-SC_OLD-700543b161f653ea41faf3d125a1eb9be389ec23.tar.gz opensim-SC_OLD-700543b161f653ea41faf3d125a1eb9be389ec23.tar.bz2 opensim-SC_OLD-700543b161f653ea41faf3d125a1eb9be389ec23.tar.xz |
BulletSim: tweek step parameters and logic to make walking up steps
closer to SL. This change should address small floor edges acting like
walls, approaching a step at any angle (other than walking backwards)
will allow walking up, and reducing the avatar pop-up when going up
stairs.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs index 8e998ba..9bbba40 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | |||
@@ -341,7 +341,7 @@ public class BSActorAvatarMove : BSActor | |||
341 | // float nearFeetHeightMin = m_controllingPrim.RawPosition.Z - (m_controllingPrim.Size.Z / 2f) + 0.05f; | 341 | // float nearFeetHeightMin = m_controllingPrim.RawPosition.Z - (m_controllingPrim.Size.Z / 2f) + 0.05f; |
342 | // Note: there is a problem with the computation of the capsule height. Thus RawPosition is off | 342 | // Note: there is a problem with the computation of the capsule height. Thus RawPosition is off |
343 | // from the height. Revisit size and this computation when height is scaled properly. | 343 | // from the height. Revisit size and this computation when height is scaled properly. |
344 | float nearFeetHeightMin = m_controllingPrim.RawPosition.Z - (m_controllingPrim.Size.Z / 2f) - 0.05f; | 344 | float nearFeetHeightMin = m_controllingPrim.RawPosition.Z - (m_controllingPrim.Size.Z / 2f) - BSParam.AvatarStepGroundFudge; |
345 | float nearFeetHeightMax = nearFeetHeightMin + BSParam.AvatarStepHeight; | 345 | float nearFeetHeightMax = nearFeetHeightMin + BSParam.AvatarStepHeight; |
346 | 346 | ||
347 | // Look for a collision point that is near the character's feet and is oriented the same as the charactor is. | 347 | // Look for a collision point that is near the character's feet and is oriented the same as the charactor is. |
@@ -363,15 +363,25 @@ public class BSActorAvatarMove : BSActor | |||
363 | if (touchPosition.Z >= nearFeetHeightMin && touchPosition.Z <= nearFeetHeightMax) | 363 | if (touchPosition.Z >= nearFeetHeightMin && touchPosition.Z <= nearFeetHeightMax) |
364 | { | 364 | { |
365 | // This contact is within the 'near the feet' range. | 365 | // This contact is within the 'near the feet' range. |
366 | // The normal should be our contact point to the object so it is pointing away | 366 | // The step is presumed to be more or less vertical. Thus the Z component should |
367 | // thus the difference between our facing orientation and the normal should be small. | 367 | // be nearly horizontal. |
368 | OMV.Vector3 directionFacing = OMV.Vector3.UnitX * m_controllingPrim.RawOrientation; | 368 | OMV.Vector3 directionFacing = OMV.Vector3.UnitX * m_controllingPrim.RawOrientation; |
369 | OMV.Vector3 touchNormal = OMV.Vector3.Normalize(kvp.Value.SurfaceNormal); | 369 | OMV.Vector3 touchNormal = OMV.Vector3.Normalize(kvp.Value.SurfaceNormal); |
370 | float diff = Math.Abs(OMV.Vector3.Distance(directionFacing, touchNormal)); | 370 | const float PIOver2 = 1.571f; // Used to make unit vector axis into approx radian angles |
371 | if (diff < BSParam.AvatarStepApproachFactor) | 371 | // m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs,avNormal={1},colNormal={2},diff={3}", |
372 | // m_controllingPrim.LocalID, directionFacing, touchNormal, | ||
373 | // Math.Abs(OMV.Vector3.Distance(directionFacing, touchNormal)) ); | ||
374 | if ((Math.Abs(directionFacing.Z) * PIOver2) < BSParam.AvatarStepAngle | ||
375 | && (Math.Abs(touchNormal.Z) * PIOver2) < BSParam.AvatarStepAngle) | ||
372 | { | 376 | { |
373 | if (highestTouchPosition.Z < touchPosition.Z) | 377 | // The normal should be our contact point to the object so it is pointing away |
374 | highestTouchPosition = touchPosition; | 378 | // thus the difference between our facing orientation and the normal should be small. |
379 | float diff = Math.Abs(OMV.Vector3.Distance(directionFacing, touchNormal)); | ||
380 | if (diff < BSParam.AvatarStepApproachFactor) | ||
381 | { | ||
382 | if (highestTouchPosition.Z < touchPosition.Z) | ||
383 | highestTouchPosition = touchPosition; | ||
384 | } | ||
375 | } | 385 | } |
376 | } | 386 | } |
377 | } | 387 | } |