diff options
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 62 |
1 files changed, 42 insertions, 20 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index bb04ea7..f7e4c1c 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | |||
@@ -715,7 +715,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
715 | Vector3 off = _velocity; | 715 | Vector3 off = _velocity; |
716 | float t = 0.5f * timeStep; | 716 | float t = 0.5f * timeStep; |
717 | off = off * t; | 717 | off = off * t; |
718 | d.Quaternion qtmp; | ||
719 | d.GeomCopyQuaternion(bbox, out qtmp); | ||
720 | Quaternion q; | ||
721 | q.X = qtmp.X; | ||
722 | q.Y = qtmp.Y; | ||
723 | q.Z = qtmp.Z; | ||
724 | q.W = qtmp.W; | ||
725 | off *= Quaternion.Conjugate(q); | ||
726 | |||
718 | d.GeomSetOffsetPosition(bbox, off.X, off.Y, off.Z); | 727 | d.GeomSetOffsetPosition(bbox, off.X, off.Y, off.Z); |
728 | |||
719 | off.X = 2.0f * (m_size.X + Math.Abs(off.X)); | 729 | off.X = 2.0f * (m_size.X + Math.Abs(off.X)); |
720 | off.Y = 2.0f * (m_size.Y + Math.Abs(off.Y)); | 730 | off.Y = 2.0f * (m_size.Y + Math.Abs(off.Y)); |
721 | off.Z = m_size.Z + 2.0f * Math.Abs(off.Z); | 731 | off.Z = m_size.Z + 2.0f * Math.Abs(off.Z); |
@@ -741,6 +751,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
741 | d.GeomSetCategoryBits(feetbox, (uint)m_collisionCategories); | 751 | d.GeomSetCategoryBits(feetbox, (uint)m_collisionCategories); |
742 | d.GeomSetCollideBits(feetbox, (uint)m_collisionFlags); | 752 | d.GeomSetCollideBits(feetbox, (uint)m_collisionFlags); |
743 | } | 753 | } |
754 | uint cat1 = d.GeomGetCategoryBits(bbox); | ||
755 | uint col1 = d.GeomGetCollideBits(bbox); | ||
756 | |||
744 | } | 757 | } |
745 | } | 758 | } |
746 | 759 | ||
@@ -1527,8 +1540,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1527 | { | 1540 | { |
1528 | if (CollisionEventsThisFrame != null) | 1541 | if (CollisionEventsThisFrame != null) |
1529 | { | 1542 | { |
1530 | CollisionEventsThisFrame.Clear(); | 1543 | lock (CollisionEventsThisFrame) |
1531 | CollisionEventsThisFrame = null; | 1544 | { |
1545 | CollisionEventsThisFrame.Clear(); | ||
1546 | CollisionEventsThisFrame = null; | ||
1547 | } | ||
1532 | } | 1548 | } |
1533 | m_eventsubscription = 0; | 1549 | m_eventsubscription = 0; |
1534 | } | 1550 | } |
@@ -1537,8 +1553,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1537 | { | 1553 | { |
1538 | if (CollisionEventsThisFrame == null) | 1554 | if (CollisionEventsThisFrame == null) |
1539 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 1555 | CollisionEventsThisFrame = new CollisionEventUpdate(); |
1540 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | 1556 | lock (CollisionEventsThisFrame) |
1541 | _parent_scene.AddCollisionEventReporting(this); | 1557 | { |
1558 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | ||
1559 | _parent_scene.AddCollisionEventReporting(this); | ||
1560 | } | ||
1542 | } | 1561 | } |
1543 | 1562 | ||
1544 | public void SendCollisions() | 1563 | public void SendCollisions() |
@@ -1546,26 +1565,29 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1546 | if (CollisionEventsThisFrame == null) | 1565 | if (CollisionEventsThisFrame == null) |
1547 | return; | 1566 | return; |
1548 | 1567 | ||
1549 | if (m_cureventsubscription < m_eventsubscription) | 1568 | lock (CollisionEventsThisFrame) |
1550 | return; | 1569 | { |
1551 | 1570 | if (m_cureventsubscription < m_eventsubscription) | |
1552 | m_cureventsubscription = 0; | 1571 | return; |
1553 | 1572 | ||
1554 | int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; | 1573 | m_cureventsubscription = 0; |
1555 | 1574 | ||
1556 | if (!SentEmptyCollisionsEvent || ncolisions > 0) | 1575 | int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; |
1557 | { | ||
1558 | base.SendCollisionUpdate(CollisionEventsThisFrame); | ||
1559 | 1576 | ||
1560 | if (ncolisions == 0) | 1577 | if (!SentEmptyCollisionsEvent || ncolisions > 0) |
1561 | { | ||
1562 | SentEmptyCollisionsEvent = true; | ||
1563 | _parent_scene.RemoveCollisionEventReporting(this); | ||
1564 | } | ||
1565 | else | ||
1566 | { | 1578 | { |
1567 | SentEmptyCollisionsEvent = false; | 1579 | base.SendCollisionUpdate(CollisionEventsThisFrame); |
1568 | CollisionEventsThisFrame.Clear(); | 1580 | |
1581 | if (ncolisions == 0) | ||
1582 | { | ||
1583 | SentEmptyCollisionsEvent = true; | ||
1584 | _parent_scene.RemoveCollisionEventReporting(this); | ||
1585 | } | ||
1586 | else | ||
1587 | { | ||
1588 | SentEmptyCollisionsEvent = false; | ||
1589 | CollisionEventsThisFrame.Clear(); | ||
1590 | } | ||
1569 | } | 1591 | } |
1570 | } | 1592 | } |
1571 | } | 1593 | } |