diff options
author | nlin | 2009-07-08 01:41:05 +0000 |
---|---|---|
committer | nlin | 2009-07-08 01:41:05 +0000 |
commit | 0ec6dfb1a1bfcbe70b40927fabca956782aa2a8c (patch) | |
tree | 039a2e269c8ed6bee86c3a87e52611aba670416d | |
parent | A stab at fixong a Windows build break (diff) | |
download | opensim-SC-0ec6dfb1a1bfcbe70b40927fabca956782aa2a8c.zip opensim-SC-0ec6dfb1a1bfcbe70b40927fabca956782aa2a8c.tar.gz opensim-SC-0ec6dfb1a1bfcbe70b40927fabca956782aa2a8c.tar.bz2 opensim-SC-0ec6dfb1a1bfcbe70b40927fabca956782aa2a8c.tar.xz |
Experimental fix for tilted avatar capsule, Mantis #2905
Set av_capsule_tilted to false in opensim.ini. Default is true, so there is
no change in avatar behavior (and no breaking of existing content which
relies on the tilted capsule).
This commit straightens up the avatar capsule so it behaves consistently
(e.g. same collision behavior against prims regardless of which direction
the avatar is coming from; ability to fit through narrow doorways).
Please note this introduces other side effects which have not been fixed.
In particular:
* The avatar frequently falls through the terrain if it is not flat, though
the avatar behaves pretty well on flat terrain. This requires investigation
of the ode terrain collider.
* The apparent foot position of the avatar with respect to the ground
is changed. This requires investigation of the avatar height/capsule height.
Please consider this as work in progress.
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 3 | ||||
-rw-r--r-- | bin/OpenSim.ini.example | 4 |
3 files changed, 33 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index e5e7d07..b832e0a 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -519,7 +519,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
519 | d.BodySetMass(Body, ref ShellMass); | 519 | d.BodySetMass(Body, ref ShellMass); |
520 | d.Matrix3 m_caprot; | 520 | d.Matrix3 m_caprot; |
521 | // 90 Stand up on the cap of the capped cyllinder | 521 | // 90 Stand up on the cap of the capped cyllinder |
522 | d.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2)); | 522 | if (_parent_scene.IsAvCapsuleTilted) |
523 | { | ||
524 | d.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2)); | ||
525 | } | ||
526 | else | ||
527 | { | ||
528 | d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2)); | ||
529 | } | ||
523 | 530 | ||
524 | 531 | ||
525 | d.GeomSetRotation(Shell, ref m_caprot); | 532 | d.GeomSetRotation(Shell, ref m_caprot); |
@@ -542,12 +549,24 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
542 | d.JointSetAMotorAngle(Amotor, 2, 0); | 549 | d.JointSetAMotorAngle(Amotor, 2, 0); |
543 | 550 | ||
544 | // These lowstops and high stops are effectively (no wiggle room) | 551 | // These lowstops and high stops are effectively (no wiggle room) |
545 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f); | 552 | if (_parent_scene.IsAvCapsuleTilted) |
546 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f); | 553 | { |
547 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f); | 554 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f); |
548 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f); | 555 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f); |
549 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f); | 556 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f); |
550 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f); | 557 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f); |
558 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f); | ||
559 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f); | ||
560 | } | ||
561 | else | ||
562 | { | ||
563 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0); | ||
564 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0); | ||
565 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0); | ||
566 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0); | ||
567 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0); | ||
568 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0); | ||
569 | } | ||
551 | 570 | ||
552 | // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the | 571 | // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the |
553 | // capped cyllinder will fall over | 572 | // capped cyllinder will fall over |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 0f92358..889afb6 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -199,6 +199,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
199 | private float avPIDP = 1400f; | 199 | private float avPIDP = 1400f; |
200 | private float avCapRadius = 0.37f; | 200 | private float avCapRadius = 0.37f; |
201 | private float avStandupTensor = 2000000f; | 201 | private float avStandupTensor = 2000000f; |
202 | private bool avCapsuleTilted = true; // true = old compatibility mode with leaning capsule; false = new corrected mode | ||
203 | public bool IsAvCapsuleTilted { get { return avCapsuleTilted; } set { avCapsuleTilted = value; } } | ||
202 | private float avDensity = 80f; | 204 | private float avDensity = 80f; |
203 | private float avHeightFudgeFactor = 0.52f; | 205 | private float avHeightFudgeFactor = 0.52f; |
204 | private float avMovementDivisorWalk = 1.3f; | 206 | private float avMovementDivisorWalk = 1.3f; |
@@ -426,6 +428,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
426 | avMovementDivisorWalk = physicsconfig.GetFloat("av_movement_divisor_walk", 1.3f); | 428 | avMovementDivisorWalk = physicsconfig.GetFloat("av_movement_divisor_walk", 1.3f); |
427 | avMovementDivisorRun = physicsconfig.GetFloat("av_movement_divisor_run", 0.8f); | 429 | avMovementDivisorRun = physicsconfig.GetFloat("av_movement_divisor_run", 0.8f); |
428 | avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f); | 430 | avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f); |
431 | avCapsuleTilted = physicsconfig.GetBoolean("av_capsule_tilted", true); | ||
429 | 432 | ||
430 | geomContactPointsStartthrottle = physicsconfig.GetInt("geom_contactpoints_start_throttling", 3); | 433 | geomContactPointsStartthrottle = physicsconfig.GetInt("geom_contactpoints_start_throttling", 3); |
431 | geomUpdatesPerThrottledUpdate = physicsconfig.GetInt("geom_updates_before_throttled_update", 15); | 434 | geomUpdatesPerThrottledUpdate = physicsconfig.GetInt("geom_updates_before_throttled_update", 15); |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 2d03731..b311064 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -473,6 +473,10 @@ | |||
473 | av_capsule_standup_tensor_win = 550000 | 473 | av_capsule_standup_tensor_win = 550000 |
474 | av_capsule_standup_tensor_linux = 550000 | 474 | av_capsule_standup_tensor_linux = 550000 |
475 | 475 | ||
476 | ; specifies if the capsule should be tilted (=true; old compatibility mode) | ||
477 | ; or straight up-and-down (=false; better and more consistent physics behavior) | ||
478 | av_capsule_tilted = true | ||
479 | |||
476 | ; used to calculate mass of avatar. | 480 | ; used to calculate mass of avatar. |
477 | ; float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH); | 481 | ; float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH); |
478 | ; av_density * AVvolume; | 482 | ; av_density * AVvolume; |