When sending object collision updates, don't null out and recreate the CollisionEventUpdate() if the number of collisions falls to zero. Reuse the existing one instead.
parent
871f1d0ae7
commit
9f19405490
|
@ -70,6 +70,11 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
// Raising the event on the object, so don't need to provide location.. further up the tree knows that info.
|
// Raising the event on the object, so don't need to provide location.. further up the tree knows that info.
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of collision events in this update.
|
||||||
|
/// </summary>
|
||||||
|
public int Count { get { return m_objCollisionList.Count; } }
|
||||||
|
|
||||||
public int m_colliderType;
|
public int m_colliderType;
|
||||||
public int m_GenericStartEnd;
|
public int m_GenericStartEnd;
|
||||||
//public uint m_LocalID;
|
//public uint m_LocalID;
|
||||||
|
|
|
@ -191,7 +191,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
private d.Mass pMass;
|
private d.Mass pMass;
|
||||||
|
|
||||||
private int m_eventsubscription;
|
private int m_eventsubscription;
|
||||||
private CollisionEventUpdate CollisionEventsThisFrame;
|
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
|
||||||
|
|
||||||
private IntPtr m_linkJoint = IntPtr.Zero;
|
private IntPtr m_linkJoint = IntPtr.Zero;
|
||||||
|
|
||||||
|
@ -3020,23 +3020,13 @@ Console.WriteLine(" JointCreateFixed");
|
||||||
|
|
||||||
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
public void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
|
||||||
{
|
{
|
||||||
if (CollisionEventsThisFrame == null)
|
|
||||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
|
||||||
|
|
||||||
CollisionEventsThisFrame.addCollider(CollidedWith, contact);
|
CollisionEventsThisFrame.addCollider(CollidedWith, contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendCollisions()
|
public void SendCollisions()
|
||||||
{
|
{
|
||||||
if (CollisionEventsThisFrame == null)
|
if (CollisionEventsThisFrame.Count > 0)
|
||||||
return;
|
base.SendCollisionUpdate(CollisionEventsThisFrame);
|
||||||
|
|
||||||
base.SendCollisionUpdate(CollisionEventsThisFrame);
|
|
||||||
|
|
||||||
if (CollisionEventsThisFrame.m_objCollisionList.Count == 0)
|
|
||||||
CollisionEventsThisFrame = null;
|
|
||||||
else
|
|
||||||
CollisionEventsThisFrame = new CollisionEventUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool SubscribedEvents()
|
public override bool SubscribedEvents()
|
||||||
|
|
Loading…
Reference in New Issue