From a7ece8c688a44c0d0b05162dbb1e98a1ea4e95ff Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 19 May 2012 00:17:37 +0100 Subject: add colliders relative velocity projected in collision direction to collisions report information. --- OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 1 + OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics/UbitOdePlugin') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index b0711d7..bfff3d4 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs @@ -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; diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index ddfdea4..11638d7 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -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: -- cgit v1.1