revert bad last changes and fix the issue another way

LSLKeyTest
UbitUmarov 2016-07-25 07:06:36 +01:00
parent f661fdf2aa
commit aa9503ab86
4 changed files with 28 additions and 11 deletions

View File

@ -396,6 +396,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
} }
public abstract Vector3 Velocity { get; set; } public abstract Vector3 Velocity { get; set; }
public virtual Vector3 rootVelocity { get; }
public abstract Vector3 Torque { get; set; } public abstract Vector3 Torque { get; set; }
public abstract float CollisionScore { get; set;} public abstract float CollisionScore { get; set;}

View File

@ -607,6 +607,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
set { return; } set { return; }
} }
public Vector3 rootVelocity
{
get
{
return _velocity;
}
}
public override Vector3 Velocity public override Vector3 Velocity
{ {
get get

View File

@ -542,13 +542,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde
} }
} }
public Vector3 rootVelocity
{
get
{
if(_parent != null)
return ((OdePrim)_parent).Velocity;
return Velocity;
}
}
public override Vector3 Velocity public override Vector3 Velocity
{ {
get get
{ {
if (_parent != null)
return ((OdePrim)_parent).Velocity;
if (_zeroFlag) if (_zeroFlag)
return Vector3.Zero; return Vector3.Zero;
return _velocity; return _velocity;

View File

@ -874,7 +874,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
break; break;
case (int)ActorTypes.Prim: case (int)ActorTypes.Prim:
Vector3 relV = p1.Velocity - p2.Velocity; Vector3 relV = p1.rootVelocity - p2.rootVelocity;
float relVlenSQ = relV.LengthSquared(); float relVlenSQ = relV.LengthSquared();
if (relVlenSQ > 0.0001f) if (relVlenSQ > 0.0001f)
{ {
@ -899,7 +899,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
bounce = contactdata1.bounce * TerrainBounce; bounce = contactdata1.bounce * TerrainBounce;
mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction);
if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f) Vector3 v1 = p1.rootVelocity;
if (Math.Abs(v1.X) > 0.1f || Math.Abs(v1.Y) > 0.1f)
mu *= frictionMovementMult; mu *= frictionMovementMult;
p1.CollidingGround = true; p1.CollidingGround = true;
@ -925,8 +926,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
// if (curContact.side1 > 0) // should be 2 ? // if (curContact.side1 > 0) // should be 2 ?
// IgnoreNegSides = true; // IgnoreNegSides = true;
Vector3 v2 = p2.rootVelocity;
if (Math.Abs(p2.Velocity.X) > 0.1f || Math.Abs(p2.Velocity.Y) > 0.1f) if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f)
mu *= frictionMovementMult; mu *= frictionMovementMult;
if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass) if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass)
@ -980,7 +981,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
p1.CollidingObj = true; p1.CollidingObj = true;
p2.CollidingObj = true; p2.CollidingObj = true;
} }
else if (p2.Velocity.LengthSquared() > 0.0f) else if (p2.rootVelocity.LengthSquared() > 0.0f)
p2.CollidingObj = true; p2.CollidingObj = true;
} }
else else
@ -995,7 +996,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
p1.CollidingObj = true; p1.CollidingObj = true;
p2.CollidingObj = true; p2.CollidingObj = true;
} }
else if (p1.Velocity.LengthSquared() > 0.0f) else if (p1.rootVelocity.LengthSquared() > 0.0f)
p1.CollidingObj = true; p1.CollidingObj = true;
} }
else else
@ -1068,10 +1069,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
Vector3 vel = Vector3.Zero; Vector3 vel = Vector3.Zero;
if (p2 != null && p2.IsPhysical) if (p2 != null && p2.IsPhysical)
vel = p2.Velocity; vel = p2.rootVelocity;
if (p1 != null && p1.IsPhysical) if (p1 != null && p1.IsPhysical)
vel -= p1.Velocity; vel -= p1.rootVelocity;
contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal); contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal);