oops i forgot the avatar knees bending on ramps... so go back..

0.9.0-post-fixes
UbitUmarov 2017-07-02 01:34:06 +01:00
parent edc7575f9e
commit f3a920237b
2 changed files with 33 additions and 24 deletions

View File

@ -899,10 +899,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
y = tx * sin + y * cos;
}
public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact,
ref bool feetcollision)
{
public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact,
ref d.ContactGeom altContact , ref bool useAltcontact, ref bool feetcollision)
{
feetcollision = false;
useAltcontact = false;
if (me == capsule)
{
@ -962,6 +963,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if(m_flying)
return true;
feetcollision = true;
if (h < boneOff)
{
m_collideNormal.X = contact.normal.X;
m_collideNormal.Y = contact.normal.Y;
m_collideNormal.Z = contact.normal.Z;
IsColliding = true;
}
altContact = contact;
useAltcontact = true;
offset.Z -= 0.2f;
offset.Normalize();
@ -980,28 +993,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (tdp > 0.25f)
tdp = 0.25f;
contact.depth = tdp;
altContact.depth = tdp;
if (reverse)
{
contact.normal.X = offset.X;
contact.normal.Y = offset.Y;
contact.normal.Z = offset.Z;
altContact.normal.X = offset.X;
altContact.normal.Y = offset.Y;
altContact.normal.Z = offset.Z;
}
else
{
contact.normal.X = -offset.X;
contact.normal.Y = -offset.Y;
contact.normal.Z = -offset.Z;
}
feetcollision = true;
if (h < boneOff)
{
m_collideNormal.X = contact.normal.X;
m_collideNormal.Y = contact.normal.Y;
m_collideNormal.Z = contact.normal.Z;
IsColliding = true;
altContact.normal.X = -offset.X;
altContact.normal.Y = -offset.Y;
altContact.normal.Z = -offset.Z;
}
return true;
}

View File

@ -951,7 +951,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
SharedTmpcontact.surface.mu = mu;
SharedTmpcontact.surface.bounce = bounce;
bool noskip = true;
d.ContactGeom altContact = new d.ContactGeom();
bool useAltcontact;
bool noskip;
if(dop1ava || dop2ava)
smoothMesh = false;
@ -959,10 +961,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
while (true)
{
noskip = true;
useAltcontact = false;
if (dop1ava)
{
if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref FeetCollision)))
if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision)))
{
if (p2.PhysicsActorType == (int)ActorTypes.Agent)
{
@ -977,7 +980,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
else if (dop2ava)
{
if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref FeetCollision)))
if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision)))
{
if (p1.PhysicsActorType == (int)ActorTypes.Agent)
{
@ -993,8 +996,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (noskip)
{
Joint = CreateContacJoint(ref curContact,smoothMesh);
if(useAltcontact)
Joint = CreateContacJoint(ref altContact,smoothMesh);
else
Joint = CreateContacJoint(ref curContact,smoothMesh);
if (Joint == IntPtr.Zero)
break;