add colliders relative velocity projected in collision direction to collisions report information.
parent
0d0c472181
commit
a7ece8c688
|
@ -59,12 +59,14 @@ namespace OpenSim.Region.Physics.Manager
|
|||
public Vector3 Position;
|
||||
public Vector3 SurfaceNormal;
|
||||
public float PenetrationDepth;
|
||||
public float RelativeSpeed;
|
||||
|
||||
public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth)
|
||||
{
|
||||
Position = position;
|
||||
SurfaceNormal = surfaceNormal;
|
||||
PenetrationDepth = penetrationDepth;
|
||||
RelativeSpeed = 0f; // for now let this one be set explicity
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -903,6 +903,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
contact.SurfaceNormal.X = 0f;
|
||||
contact.SurfaceNormal.Y = 0f;
|
||||
contact.SurfaceNormal.Z = -1f;
|
||||
contact.RelativeSpeed = -vel.Z;
|
||||
AddCollisionEvent(0, contact);
|
||||
|
||||
vec.Z *= 0.5f;
|
||||
|
|
|
@ -1064,7 +1064,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
obj2LocalID = 0;
|
||||
bool p1events = p1.SubscribedEvents();
|
||||
bool p2events = p2.SubscribedEvents();
|
||||
|
||||
|
||||
if (p1.IsVolumeDtc)
|
||||
p2events = false;
|
||||
if (p2.IsVolumeDtc)
|
||||
|
@ -1073,6 +1073,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
if (!(p2events || p1events))
|
||||
return;
|
||||
|
||||
Vector3 vel = Vector3.Zero;
|
||||
if (p2 != null && p2.IsPhysical)
|
||||
vel = p2.Velocity;
|
||||
|
||||
if (p1 != null && p1.IsPhysical)
|
||||
vel -= p1.Velocity;
|
||||
|
||||
contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal);
|
||||
|
||||
switch ((ActorTypes)p1.PhysicsActorType)
|
||||
{
|
||||
case ActorTypes.Agent:
|
||||
|
|
Loading…
Reference in New Issue