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.
trunk
nlin 2009-07-08 01:41:05 +00:00
parent a752936613
commit 0ec6dfb1a1
3 changed files with 33 additions and 7 deletions

View File

@ -519,7 +519,14 @@ namespace OpenSim.Region.Physics.OdePlugin
d.BodySetMass(Body, ref ShellMass);
d.Matrix3 m_caprot;
// 90 Stand up on the cap of the capped cyllinder
d.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2));
if (_parent_scene.IsAvCapsuleTilted)
{
d.RFromAxisAndAngle(out m_caprot, 1, 0, 1, (float)(Math.PI / 2));
}
else
{
d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2));
}
d.GeomSetRotation(Shell, ref m_caprot);
@ -542,12 +549,24 @@ namespace OpenSim.Region.Physics.OdePlugin
d.JointSetAMotorAngle(Amotor, 2, 0);
// These lowstops and high stops are effectively (no wiggle room)
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
if (_parent_scene.IsAvCapsuleTilted)
{
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f);
}
else
{
d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0);
d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0);
d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0);
}
// Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the
// capped cyllinder will fall over

View File

@ -199,6 +199,8 @@ namespace OpenSim.Region.Physics.OdePlugin
private float avPIDP = 1400f;
private float avCapRadius = 0.37f;
private float avStandupTensor = 2000000f;
private bool avCapsuleTilted = true; // true = old compatibility mode with leaning capsule; false = new corrected mode
public bool IsAvCapsuleTilted { get { return avCapsuleTilted; } set { avCapsuleTilted = value; } }
private float avDensity = 80f;
private float avHeightFudgeFactor = 0.52f;
private float avMovementDivisorWalk = 1.3f;
@ -426,6 +428,7 @@ namespace OpenSim.Region.Physics.OdePlugin
avMovementDivisorWalk = physicsconfig.GetFloat("av_movement_divisor_walk", 1.3f);
avMovementDivisorRun = physicsconfig.GetFloat("av_movement_divisor_run", 0.8f);
avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f);
avCapsuleTilted = physicsconfig.GetBoolean("av_capsule_tilted", true);
geomContactPointsStartthrottle = physicsconfig.GetInt("geom_contactpoints_start_throttling", 3);
geomUpdatesPerThrottledUpdate = physicsconfig.GetInt("geom_updates_before_throttled_update", 15);

View File

@ -473,6 +473,10 @@
av_capsule_standup_tensor_win = 550000
av_capsule_standup_tensor_linux = 550000
; specifies if the capsule should be tilted (=true; old compatibility mode)
; or straight up-and-down (=false; better and more consistent physics behavior)
av_capsule_tilted = true
; used to calculate mass of avatar.
; float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH);
; av_density * AVvolume;