ubOde try to improve contact velocity on first avatar collision with terrain

LSLKeyTest
UbitUmarov 2016-07-24 21:29:34 +01:00
parent 574b97d93d
commit a572a22dd9
1 changed files with 5 additions and 2 deletions

View File

@ -80,6 +80,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private Vector3 m_rotationalVelocity; private Vector3 m_rotationalVelocity;
private Vector3 m_size; private Vector3 m_size;
private Vector3 m_collideNormal; private Vector3 m_collideNormal;
private Vector3 m_lastFallVel;
private Quaternion m_orientation; private Quaternion m_orientation;
private Quaternion m_orientation2D; private Quaternion m_orientation2D;
private float m_mass = 80f; private float m_mass = 80f;
@ -1114,7 +1115,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_iscollidingGround = true; m_iscollidingGround = true;
ContactPoint contact = new ContactPoint(); ContactPoint contact = new ContactPoint();
contact.PenetrationDepth = depth; contact.PenetrationDepth = depth;
contact.Position.X = localpos.X; contact.Position.X = localpos.X;
@ -1123,9 +1123,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
contact.SurfaceNormal.X = -n.X; contact.SurfaceNormal.X = -n.X;
contact.SurfaceNormal.Y = -n.Y; contact.SurfaceNormal.Y = -n.Y;
contact.SurfaceNormal.Z = -n.Z; contact.SurfaceNormal.Z = -n.Z;
contact.RelativeSpeed = -vel.Z; contact.RelativeSpeed = -Vector3.Dot(m_lastFallVel, contact.SurfaceNormal);;
contact.CharacterFeet = true; contact.CharacterFeet = true;
AddCollisionEvent(0, contact); AddCollisionEvent(0, contact);
m_lastFallVel = vel;
// vec.Z *= 0.5f; // vec.Z *= 0.5f;
} }
@ -1133,6 +1134,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
else else
{ {
m_lastFallVel = vel;
m_colliderGroundfilter -= 5; m_colliderGroundfilter -= 5;
if (m_colliderGroundfilter <= 0) if (m_colliderGroundfilter <= 0)
{ {
@ -1143,6 +1145,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
} }
else else
{ {
m_lastFallVel = vel;
m_colliderGroundfilter -= 5; m_colliderGroundfilter -= 5;
if (m_colliderGroundfilter <= 0) if (m_colliderGroundfilter <= 0)
{ {