aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2015-01-07 11:09:04 -0800
committerDiva Canto2015-01-07 11:09:04 -0800
commit14b3ee636d26605fb1f17f064f12989a21f33ebf (patch)
tree3f7321aa45d05685af88ffbdc79edb8f8462bf68
parentAdded a different/better way of specifying data services in DataSnapshot -- u... (diff)
parentBulletSim: fix line ending problems. (diff)
downloadopensim-SC-14b3ee636d26605fb1f17f064f12989a21f33ebf.zip
opensim-SC-14b3ee636d26605fb1f17f064f12989a21f33ebf.tar.gz
opensim-SC-14b3ee636d26605fb1f17f064f12989a21f33ebf.tar.bz2
opensim-SC-14b3ee636d26605fb1f17f064f12989a21f33ebf.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs24
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs14
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs2
-rw-r--r--bin/OpenSimDefaults.ini11
4 files changed, 39 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
index 8e998ba..c0d65be 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 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index e7f4def..ef75e3f 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -153,6 +153,8 @@ public static class BSParam
153 public static int AvatarJumpFrames { get; private set; } 153 public static int AvatarJumpFrames { get; private set; }
154 public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } 154 public static float AvatarBelowGroundUpCorrectionMeters { get; private set; }
155 public static float AvatarStepHeight { get; private set; } 155 public static float AvatarStepHeight { get; private set; }
156 public static float AvatarStepAngle { get; private set; }
157 public static float AvatarStepGroundFudge { get; private set; }
156 public static float AvatarStepApproachFactor { get; private set; } 158 public static float AvatarStepApproachFactor { get; private set; }
157 public static float AvatarStepForceFactor { get; private set; } 159 public static float AvatarStepForceFactor { get; private set; }
158 public static float AvatarStepUpCorrectionFactor { get; private set; } 160 public static float AvatarStepUpCorrectionFactor { get; private set; }
@@ -614,13 +616,17 @@ public static class BSParam
614 new ParameterDefn<int>("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.", 616 new ParameterDefn<int>("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.",
615 4 ), 617 4 ),
616 new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction", 618 new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction",
617 0.6f ) , 619 0.999f ) ,
620 new ParameterDefn<float>("AvatarStepAngle", "The angle (in radians) for a vertical surface to be considered a step",
621 0.3f ) ,
622 new ParameterDefn<float>("AvatarStepGroundFudge", "Fudge factor subtracted from avatar base when comparing collision height",
623 0.1f ) ,
618 new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", 624 new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)",
619 0.6f ), 625 2f ),
620 new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", 626 new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step",
621 1.0f ), 627 0f ),
622 new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", 628 new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step",
623 2.0f ), 629 0.8f ),
624 new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", 630 new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs",
625 1 ), 631 1 ),
626 632
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs b/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs
index ed7ff9b..3651351 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs
@@ -136,7 +136,7 @@ public class HullCreation : OpenSimTestCase
136 pbs.ProfileShape = (byte)ProfileShape.Circle; 136 pbs.ProfileShape = (byte)ProfileShape.Circle;
137 pbs.PathCurve = (byte)Extrusion.Curve1; 137 pbs.PathCurve = (byte)Extrusion.Curve1;
138 pbs.PathScaleX = 100; // default hollow info as set in the viewer 138 pbs.PathScaleX = 100; // default hollow info as set in the viewer
139 pbs.PathScaleY = 25; 139 pbs.PathScaleY = (int)(.25f / 0.01f) + 200;
140 pos = new Vector3(120.0f, 120.0f, 0f); 140 pos = new Vector3(120.0f, 120.0f, 0f);
141 pos.Z = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos) + 10f; 141 pos.Z = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos) + 10f;
142 ObjectInitPosition = pos; 142 ObjectInitPosition = pos;
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 654b323..ad33423 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -1070,6 +1070,17 @@
1070 AvatarHeightMidFudge = 0 ; Adjustment at mid point of avatar height range 1070 AvatarHeightMidFudge = 0 ; Adjustment at mid point of avatar height range
1071 AvatarHeightHighFudge = 0 ; Adjustment at high end of height range 1071 AvatarHeightHighFudge = 0 ; Adjustment at high end of height range
1072 1072
1073 ; Avatar walk-up-stairs parameters
1074 ; If an avatar collides with an object 'close to its feet', the avatar will be
1075 ; moved/pushed up do simulate stepping up.
1076 ;AvatarStepHeight = 0.6f ; The height, below which is considered a step collision.
1077 ;AvatarStepAngle = 0.3f ; The angle from vertical (in radians) to consider a surface a step
1078 ;AvatarStepApproachFactor = 2f ; Approach angle factor. O=straight on, .6=~45 degrees.
1079 ;AvatarStepGroundFudge = 0.1f ; Fudge added to bottom of avatar below which step collisions happen
1080 ;AvatarStepForceFactor = 0f ; Avatar is pushed up by its mass times this factor
1081 ;AvatarStepUpCorrectionFactor = 0.8f ; Avatar is displaced up the collision height times this factor
1082 ;AvatarStepSmoothingSteps = 1 ; Number of frames after a step collision that up correction is applied
1083
1073 ; Terminal velocity of a falling avatar 1084 ; Terminal velocity of a falling avatar
1074 ; This is the same http://en.wikipedia.org/wiki/Terminal_velocity#Examples 1085 ; This is the same http://en.wikipedia.org/wiki/Terminal_velocity#Examples
1075 ; negative for a downward speed. 1086 ; negative for a downward speed.