Fix a bug I introduced yesterday in ODE physics where prim scripts would only receive the very first collision.
parent
05dff4987b
commit
88ef35cb23
|
@ -2082,6 +2082,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void PhysicsCollision(EventArgs e)
|
public void PhysicsCollision(EventArgs e)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("Invoking PhysicsCollision on {0} {1} {2}", Name, LocalId, UUID);
|
||||||
|
|
||||||
// single threaded here
|
// single threaded here
|
||||||
|
|
||||||
CollisionEventUpdate a = (CollisionEventUpdate)e;
|
CollisionEventUpdate a = (CollisionEventUpdate)e;
|
||||||
|
|
|
@ -76,6 +76,8 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Count { get { return m_objCollisionList.Count; } }
|
public int Count { get { return m_objCollisionList.Count; } }
|
||||||
|
|
||||||
|
public bool CollisionsOnPreviousFrame { get; private set; }
|
||||||
|
|
||||||
public Dictionary<uint, ContactPoint> m_objCollisionList;
|
public Dictionary<uint, ContactPoint> m_objCollisionList;
|
||||||
|
|
||||||
public CollisionEventUpdate(Dictionary<uint, ContactPoint> objCollisionList)
|
public CollisionEventUpdate(Dictionary<uint, ContactPoint> objCollisionList)
|
||||||
|
|
|
@ -193,6 +193,15 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private int m_eventsubscription;
|
private int m_eventsubscription;
|
||||||
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
|
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Signal whether there were collisions on the previous frame, so we know if we need to send the
|
||||||
|
/// empty CollisionEventsThisFrame to the prim so that it can detect the end of a collision.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is probably a temporary measure, pending storing this information consistently in CollisionEventUpdate itself.
|
||||||
|
/// </remarks>
|
||||||
|
private bool m_collisionsOnPreviousFrame;
|
||||||
|
|
||||||
private IntPtr m_linkJoint = IntPtr.Zero;
|
private IntPtr m_linkJoint = IntPtr.Zero;
|
||||||
|
|
||||||
internal volatile bool childPrim;
|
internal volatile bool childPrim;
|
||||||
|
@ -3025,8 +3034,20 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
|
|
||||||
public void SendCollisions()
|
public void SendCollisions()
|
||||||
{
|
{
|
||||||
if (CollisionEventsThisFrame.Count > 0)
|
if (m_collisionsOnPreviousFrame || CollisionEventsThisFrame.Count > 0)
|
||||||
|
{
|
||||||
base.SendCollisionUpdate(CollisionEventsThisFrame);
|
base.SendCollisionUpdate(CollisionEventsThisFrame);
|
||||||
|
|
||||||
|
if (CollisionEventsThisFrame.Count > 0)
|
||||||
|
{
|
||||||
|
m_collisionsOnPreviousFrame = true;
|
||||||
|
CollisionEventsThisFrame.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_collisionsOnPreviousFrame = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool SubscribedEvents()
|
public override bool SubscribedEvents()
|
||||||
|
|
Loading…
Reference in New Issue