* Tweaks the hard cut to apply to collisions of Greater then Normal Z 0.95. This fits within Ubit's framework of multi-body collisions, just moves the reactive force to the Midboxgeom(actual detection) instead of the bigbox geom(pre detection)

avinationmerge
teravus 2013-05-14 19:17:31 -04:00
parent f9daf921f7
commit 799ba5aa7b
1 changed files with 27 additions and 1 deletions

View File

@ -1045,12 +1045,37 @@ namespace OpenSim.Region.Physics.OdePlugin
if (me == midbox) if (me == midbox)
{ {
if (Math.Abs(contact.normal.Z) > 0.95f) if (Math.Abs(contact.normal.Z) > 0.95f)
{
offset.Z = contact.pos.Z - _position.Z; offset.Z = contact.pos.Z - _position.Z;
offset.X = (float)Math.Abs(offset.X) * 0.5f + contact.depth;
offset.Y = (float)Math.Abs(offset.Y) * 0.5f + contact.depth;
offset.Z = (float)Math.Abs(offset.Z) * 0.5f + contact.depth;
if (reverse)
{
offset.X *= -contact.normal.X;
offset.Y *= -contact.normal.Y;
offset.Z *= -contact.normal.Z;
}
else
{
offset.X *= contact.normal.X;
offset.Y *= contact.normal.Y;
offset.Z *= contact.normal.Z;
}
offset.X += contact.pos.X;
offset.Y += contact.pos.Y;
offset.Z += contact.pos.Z;
_position = offset;
return true;
}
else else
offset.Z = contact.normal.Z; offset.Z = contact.normal.Z;
offset.Normalize(); offset.Normalize();
/*
if (reverse) if (reverse)
{ {
contact.normal.X = offset.X; contact.normal.X = offset.X;
@ -1063,7 +1088,8 @@ namespace OpenSim.Region.Physics.OdePlugin
contact.normal.Y = -offset.Y; contact.normal.Y = -offset.Y;
contact.normal.Z = -offset.Z; contact.normal.Z = -offset.Z;
} }
*/
//_position.Z = offset.Z;
return true; return true;
} }