diff options
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 86385bf..2dfcca6 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
147 | 147 | ||
148 | public struct ODEchangeitem | 148 | public struct ODEchangeitem |
149 | { | 149 | { |
150 | public OdePrim prim; | 150 | public PhysicsActor actor; |
151 | public OdeCharacter character; | 151 | public OdeCharacter character; |
152 | public changes what; | 152 | public changes what; |
153 | public Object arg; | 153 | public Object arg; |
@@ -187,7 +187,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
187 | public float gravityy = 0f; | 187 | public float gravityy = 0f; |
188 | public float gravityz = -9.8f; | 188 | public float gravityz = -9.8f; |
189 | 189 | ||
190 | |||
191 | private float waterlevel = 0f; | 190 | private float waterlevel = 0f; |
192 | private int framecount = 0; | 191 | private int framecount = 0; |
193 | 192 | ||
@@ -1558,23 +1557,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1558 | return true; | 1557 | return true; |
1559 | } | 1558 | } |
1560 | 1559 | ||
1561 | public void AddChange(OdePrim prim, changes what, Object arg) | ||
1562 | { | ||
1563 | ODEchangeitem item = new ODEchangeitem(); | ||
1564 | item.prim = prim; | ||
1565 | item.what = what; | ||
1566 | item.arg = arg; | ||
1567 | ChangesQueue.Enqueue(item); | ||
1568 | } | ||
1569 | |||
1570 | /// <summary> | 1560 | /// <summary> |
1571 | /// Called to queue a change to a prim | 1561 | /// Called to queue a change to a actor |
1572 | /// to use in place of old taint mechanism so changes do have a time sequence | 1562 | /// to use in place of old taint mechanism so changes do have a time sequence |
1573 | /// </summary> | 1563 | /// </summary> |
1574 | public void AddChange(OdeCharacter character, changes what, Object arg) | 1564 | |
1565 | public void AddChange(PhysicsActor actor, changes what, Object arg) | ||
1575 | { | 1566 | { |
1576 | ODEchangeitem item = new ODEchangeitem(); | 1567 | ODEchangeitem item = new ODEchangeitem(); |
1577 | item.character = character; | 1568 | item.actor = actor; |
1578 | item.what = what; | 1569 | item.what = what; |
1579 | item.arg = arg; | 1570 | item.arg = arg; |
1580 | ChangesQueue.Enqueue(item); | 1571 | ChangesQueue.Enqueue(item); |
@@ -1687,25 +1678,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1687 | // clear pointer/counter to contacts to pass into joints | 1678 | // clear pointer/counter to contacts to pass into joints |
1688 | m_global_contactcount = 0; | 1679 | m_global_contactcount = 0; |
1689 | 1680 | ||
1690 | // do characters requested changes | ||
1691 | |||
1692 | OdeCharacter character; | ||
1693 | int numtaints; | ||
1694 | lock (_taintedCharacterLock) | ||
1695 | { | ||
1696 | numtaints = _taintedCharacterQ.Count; | ||
1697 | // if (numtaints > 50) | ||
1698 | // numtaints = 50; | ||
1699 | while (numtaints > 0) | ||
1700 | { | ||
1701 | character = _taintedCharacterQ.Dequeue(); | ||
1702 | character.ProcessTaints(ODE_STEPSIZE); | ||
1703 | _taintedCharacterH.Remove(character); | ||
1704 | numtaints--; | ||
1705 | } | ||
1706 | } | ||
1707 | // do other objects requested changes | ||
1708 | |||
1709 | ODEchangeitem item; | 1681 | ODEchangeitem item; |
1710 | 1682 | ||
1711 | if(ChangesQueue.Count >0) | 1683 | if(ChangesQueue.Count >0) |
@@ -1716,14 +1688,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1716 | 1688 | ||
1717 | while(ChangesQueue.Dequeue(out item)) | 1689 | while(ChangesQueue.Dequeue(out item)) |
1718 | { | 1690 | { |
1719 | if (item.prim != null) | 1691 | if (item.actor != null) |
1720 | { | 1692 | { |
1721 | try | 1693 | try |
1722 | { | 1694 | { |
1723 | if (item.prim.DoAChange(item.what, item.arg)) | 1695 | if (item.actor is OdeCharacter) |
1724 | RemovePrimThreadLocked(item.prim); | 1696 | ((OdeCharacter)item.actor).DoAChange(item.what, item.arg); |
1697 | else if (((OdePrim)item.actor).DoAChange(item.what, item.arg)) | ||
1698 | RemovePrimThreadLocked((OdePrim)item.actor); | ||
1725 | } | 1699 | } |
1726 | catch { }; | 1700 | catch |
1701 | { | ||
1702 | m_log.Warn("[PHYSICS]: doChange failed for a actor"); | ||
1703 | }; | ||
1727 | } | 1704 | } |
1728 | ttmp = Util.EnvironmentTickCountSubtract(ttmpstart); | 1705 | ttmp = Util.EnvironmentTickCountSubtract(ttmpstart); |
1729 | if (ttmp > 20) | 1706 | if (ttmp > 20) |