preserve max relative velocity on a colision report time slice

LSLKeyTest
UbitUmarov 2016-07-25 00:47:43 +01:00
parent 0a9f06fda7
commit 42a072d181
1 changed files with 12 additions and 1 deletions

View File

@ -126,9 +126,20 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
m_objCollisionList.Add(localID, contact); m_objCollisionList.Add(localID, contact);
} }
else else
{ {
float lastVel = m_objCollisionList[localID].RelativeSpeed;
if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth) if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth)
{
if(Math.Abs(lastVel) > Math.Abs(contact.RelativeSpeed))
contact.RelativeSpeed = lastVel;
m_objCollisionList[localID] = contact; 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;
}
} }
} }