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

View File

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