diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 3a5a936..9640e91 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | |||
@@ -112,7 +112,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
112 | private bool _zeroFlag = false; | 112 | private bool _zeroFlag = false; |
113 | private bool m_haveLastFallVel = false; | 113 | private bool m_haveLastFallVel = false; |
114 | 114 | ||
115 | |||
116 | private uint m_localID = 0; | 115 | private uint m_localID = 0; |
117 | public bool m_returnCollisions = false; | 116 | public bool m_returnCollisions = false; |
118 | // taints and their non-tainted counterparts | 117 | // taints and their non-tainted counterparts |
@@ -149,7 +148,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
149 | 148 | ||
150 | public int m_eventsubscription = 0; | 149 | public int m_eventsubscription = 0; |
151 | private int m_cureventsubscription = 0; | 150 | private int m_cureventsubscription = 0; |
152 | private CollisionEventUpdate CollisionEventsThisFrame = null; | 151 | private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); |
153 | private bool SentEmptyCollisionsEvent; | 152 | private bool SentEmptyCollisionsEvent; |
154 | 153 | ||
155 | // unique UUID of this character object | 154 | // unique UUID of this character object |
@@ -1556,32 +1555,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1556 | 1555 | ||
1557 | public override float APIDDamping { set { return; } } | 1556 | public override float APIDDamping { set { return; } } |
1558 | 1557 | ||
1559 | |||
1560 | public override void SubscribeEvents(int ms) | 1558 | public override void SubscribeEvents(int ms) |
1561 | { | 1559 | { |
1562 | m_eventsubscription = ms; | 1560 | m_eventsubscription = ms; |
1563 | m_cureventsubscription = 0; | 1561 | m_cureventsubscription = 0; |
1564 | if (CollisionEventsThisFrame == null) | 1562 | CollisionEventsThisFrame.Clear(); |
1565 | CollisionEventsThisFrame = new CollisionEventUpdate(); | ||
1566 | SentEmptyCollisionsEvent = false; | 1563 | SentEmptyCollisionsEvent = false; |
1567 | } | 1564 | } |
1568 | 1565 | ||
1569 | public override void UnSubscribeEvents() | 1566 | public override void UnSubscribeEvents() |
1570 | { | 1567 | { |
1571 | if (CollisionEventsThisFrame != null) | ||
1572 | { | ||
1573 | CollisionEventsThisFrame.Clear(); | ||
1574 | CollisionEventsThisFrame = null; | ||
1575 | } | ||
1576 | m_eventsubscription = 0; | 1568 | m_eventsubscription = 0; |
1577 | _parent_scene.RemoveCollisionEventReporting(this); | 1569 | _parent_scene.RemoveCollisionEventReporting(this); |
1570 | lock(CollisionEventsThisFrame) | ||
1571 | CollisionEventsThisFrame.Clear(); | ||
1578 | } | 1572 | } |
1579 | 1573 | ||
1580 | public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) | 1574 | public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) |
1581 | { | 1575 | { |
1582 | if (CollisionEventsThisFrame == null) | 1576 | lock(CollisionEventsThisFrame) |
1583 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 1577 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); |
1584 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | ||
1585 | _parent_scene.AddCollisionEventReporting(this); | 1578 | _parent_scene.AddCollisionEventReporting(this); |
1586 | } | 1579 | } |
1587 | 1580 | ||
@@ -1590,28 +1583,28 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1590 | if (m_cureventsubscription < 50000) | 1583 | if (m_cureventsubscription < 50000) |
1591 | m_cureventsubscription += timestep; | 1584 | m_cureventsubscription += timestep; |
1592 | 1585 | ||
1593 | if (CollisionEventsThisFrame == null) | ||
1594 | return; | ||
1595 | |||
1596 | if (m_cureventsubscription < m_eventsubscription) | 1586 | if (m_cureventsubscription < m_eventsubscription) |
1597 | return; | 1587 | return; |
1598 | 1588 | ||
1599 | int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; | 1589 | lock(CollisionEventsThisFrame) |
1600 | |||
1601 | if (!SentEmptyCollisionsEvent || ncolisions > 0) | ||
1602 | { | 1590 | { |
1603 | base.SendCollisionUpdate(CollisionEventsThisFrame); | 1591 | int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; |
1604 | m_cureventsubscription = 0; | ||
1605 | 1592 | ||
1606 | if (ncolisions == 0) | 1593 | if (!SentEmptyCollisionsEvent || ncolisions > 0) |
1607 | { | 1594 | { |
1608 | SentEmptyCollisionsEvent = true; | 1595 | base.SendCollisionUpdate(CollisionEventsThisFrame); |
1609 | // _parent_scene.RemoveCollisionEventReporting(this); | 1596 | m_cureventsubscription = 0; |
1610 | } | 1597 | |
1611 | else | 1598 | if (ncolisions == 0) |
1612 | { | 1599 | { |
1613 | SentEmptyCollisionsEvent = false; | 1600 | SentEmptyCollisionsEvent = true; |
1614 | CollisionEventsThisFrame.Clear(); | 1601 | // _parent_scene.RemoveCollisionEventReporting(this); |
1602 | } | ||
1603 | else | ||
1604 | { | ||
1605 | SentEmptyCollisionsEvent = false; | ||
1606 | CollisionEventsThisFrame.Clear(); | ||
1607 | } | ||
1615 | } | 1608 | } |
1616 | } | 1609 | } |
1617 | } | 1610 | } |