ubitODE fix don't report colisions with a volume detector ( only report to it )

avinationmerge
UbitUmarov 2012-04-27 06:00:50 +01:00
parent e974d493c6
commit 6edbbdc83a
1 changed files with 16 additions and 12 deletions

View File

@ -1020,12 +1020,16 @@ namespace OpenSim.Region.Physics.OdePlugin
private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact) private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, ContactPoint contact)
{ {
// obj1LocalID = 0;
//returncollisions = false;
obj2LocalID = 0; obj2LocalID = 0;
//ctype = 0; bool p1events = p1.SubscribedEvents();
//cStartStop = 0; bool p2events = p2.SubscribedEvents();
if (!(p2.SubscribedEvents() || p1.SubscribedEvents()))
if (p1 is OdePrim && p1.IsVolumeDtc)
p2events = false;
if (p2 is OdePrim && p2.IsVolumeDtc)
p1events = false;
if (!(p2events || p1events))
return; return;
switch ((ActorTypes)p1.PhysicsActorType) switch ((ActorTypes)p1.PhysicsActorType)
@ -1037,7 +1041,7 @@ namespace OpenSim.Region.Physics.OdePlugin
case ActorTypes.Agent: case ActorTypes.Agent:
cc2 = (OdeCharacter)p2; cc2 = (OdeCharacter)p2;
obj2LocalID = cc2.m_localID; obj2LocalID = cc2.m_localID;
if (p2.SubscribedEvents()) if (p2events)
cc2.AddCollisionEvent(cc1.m_localID, contact); cc2.AddCollisionEvent(cc1.m_localID, contact);
break; break;
@ -1046,7 +1050,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
cp2 = (OdePrim)p2; cp2 = (OdePrim)p2;
obj2LocalID = cp2.m_localID; obj2LocalID = cp2.m_localID;
if (p2.SubscribedEvents()) if (p2events)
cp2.AddCollisionEvent(cc1.m_localID, contact); cp2.AddCollisionEvent(cc1.m_localID, contact);
} }
break; break;
@ -1057,7 +1061,7 @@ namespace OpenSim.Region.Physics.OdePlugin
obj2LocalID = 0; obj2LocalID = 0;
break; break;
} }
if (p1.SubscribedEvents()) if (p1events)
{ {
contact.SurfaceNormal = -contact.SurfaceNormal; contact.SurfaceNormal = -contact.SurfaceNormal;
cc1.AddCollisionEvent(obj2LocalID, contact); cc1.AddCollisionEvent(obj2LocalID, contact);
@ -1078,7 +1082,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
cc2 = (OdeCharacter)p2; cc2 = (OdeCharacter)p2;
obj2LocalID = cc2.m_localID; obj2LocalID = cc2.m_localID;
if (p2.SubscribedEvents()) if (p2events)
cc2.AddCollisionEvent(cp1.m_localID, contact); cc2.AddCollisionEvent(cp1.m_localID, contact);
} }
break; break;
@ -1088,7 +1092,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
cp2 = (OdePrim)p2; cp2 = (OdePrim)p2;
obj2LocalID = cp2.m_localID; obj2LocalID = cp2.m_localID;
if (p2.SubscribedEvents()) if (p2events)
cp2.AddCollisionEvent(cp1.m_localID, contact); cp2.AddCollisionEvent(cp1.m_localID, contact);
} }
break; break;
@ -1099,7 +1103,7 @@ namespace OpenSim.Region.Physics.OdePlugin
obj2LocalID = 0; obj2LocalID = 0;
break; break;
} }
if (p1.SubscribedEvents()) if (p1events)
{ {
contact.SurfaceNormal = -contact.SurfaceNormal; contact.SurfaceNormal = -contact.SurfaceNormal;
cp1.AddCollisionEvent(obj2LocalID, contact); cp1.AddCollisionEvent(obj2LocalID, contact);
@ -1734,7 +1738,7 @@ namespace OpenSim.Region.Physics.OdePlugin
base.TriggerPhysicsBasedRestart(); base.TriggerPhysicsBasedRestart();
} }
while (step_time >= HalfOdeStep && nodeframes < 10) //limit number of steps so we don't say here for ever while (step_time > HalfOdeStep && nodeframes < 10) //limit number of steps so we don't say here for ever
{ {
try try
{ {