From 42a072d1814f68238cdbb4c977222bb5d620c827 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Jul 2016 00:47:43 +0100 Subject: [PATCH] preserve max relative velocity on a colision report time slice --- .../PhysicsModules/SharedBase/PhysicsActor.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index 393afaeabd..f82e2899d7 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs @@ -126,9 +126,20 @@ namespace OpenSim.Region.PhysicsModules.SharedBase m_objCollisionList.Add(localID, contact); } else - { + { + float lastVel = m_objCollisionList[localID].RelativeSpeed; if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth) + { + if(Math.Abs(lastVel) > Math.Abs(contact.RelativeSpeed)) + contact.RelativeSpeed = lastVel; m_objCollisionList[localID] = contact; + } + else if(Math.Abs(lastVel) < Math.Abs(contact.RelativeSpeed)) + { + ContactPoint tmp = m_objCollisionList[localID]; + tmp.RelativeSpeed = contact.RelativeSpeed; + m_objCollisionList[localID] = tmp; + } } }