diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdeScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 77 |
1 files changed, 51 insertions, 26 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 99392cc..a307469 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -1677,7 +1677,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, | 1679 | private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, |
1680 | IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) | 1680 | IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, uint localID) |
1681 | { | 1681 | { |
1682 | Vector3 pos = position; | 1682 | Vector3 pos = position; |
1683 | Vector3 siz = size; | 1683 | Vector3 siz = size; |
@@ -1691,7 +1691,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1691 | lock (_prims) | 1691 | lock (_prims) |
1692 | _prims.Add(newPrim); | 1692 | _prims.Add(newPrim); |
1693 | } | 1693 | } |
1694 | 1694 | newPrim.LocalID = localID; | |
1695 | return newPrim; | 1695 | return newPrim; |
1696 | } | 1696 | } |
1697 | 1697 | ||
@@ -1708,13 +1708,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1708 | } | 1708 | } |
1709 | 1709 | ||
1710 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | 1710 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
1711 | Vector3 size, Quaternion rotation) //To be removed | 1711 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid) |
1712 | { | ||
1713 | return AddPrimShape(primName, pbs, position, size, rotation, false); | ||
1714 | } | ||
1715 | |||
1716 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
1717 | Vector3 size, Quaternion rotation, bool isPhysical) | ||
1718 | { | 1712 | { |
1719 | #if SPAM | 1713 | #if SPAM |
1720 | m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName); | 1714 | m_log.DebugFormat("[PHYSICS]: Adding physics actor to {0}", primName); |
@@ -1723,22 +1717,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1723 | PhysicsActor result; | 1717 | PhysicsActor result; |
1724 | IMesh mesh = null; | 1718 | IMesh mesh = null; |
1725 | 1719 | ||
1726 | if (needsMeshing(pbs)) | 1720 | // Don't create the mesh here - wait until the mesh data is loaded from the asset store. |
1727 | { | 1721 | // if (needsMeshing(pbs)) |
1728 | try | 1722 | // { |
1729 | { | 1723 | // try |
1730 | mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical); | 1724 | // { |
1731 | } | 1725 | // mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical); |
1732 | catch(Exception e) | 1726 | // } |
1733 | { | 1727 | // catch(Exception e) |
1734 | m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName); | 1728 | // { |
1735 | m_log.Debug(e.ToString()); | 1729 | // m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}.", primName); |
1736 | mesh = null; | 1730 | // m_log.Debug(e.ToString()); |
1737 | return null; | 1731 | // mesh = null; |
1738 | } | 1732 | // return null; |
1739 | } | 1733 | // } |
1740 | 1734 | // } | |
1741 | result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); | 1735 | |
1736 | result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, localid); | ||
1742 | 1737 | ||
1743 | return result; | 1738 | return result; |
1744 | } | 1739 | } |
@@ -2590,7 +2585,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2590 | { | 2585 | { |
2591 | if (!(_taintedPrimH.Contains(taintedprim))) | 2586 | if (!(_taintedPrimH.Contains(taintedprim))) |
2592 | { | 2587 | { |
2593 | //Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.m_primName); | 2588 | #if SPAM |
2589 | Console.WriteLine("AddPhysicsActorTaint to " + taintedprim.Name); | ||
2590 | #endif | ||
2594 | _taintedPrimH.Add(taintedprim); // HashSet for searching | 2591 | _taintedPrimH.Add(taintedprim); // HashSet for searching |
2595 | _taintedPrimL.Add(taintedprim); // List for ordered readout | 2592 | _taintedPrimL.Add(taintedprim); // List for ordered readout |
2596 | } | 2593 | } |
@@ -3733,6 +3730,34 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3733 | } | 3730 | } |
3734 | } | 3731 | } |
3735 | 3732 | ||
3733 | public override void RaycastWorld(Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) | ||
3734 | { | ||
3735 | if (retMethod != null) | ||
3736 | { | ||
3737 | m_rayCastManager.QueueRequest(position, direction, length, Count, retMethod); | ||
3738 | } | ||
3739 | } | ||
3740 | |||
3741 | public override List<ContactResult> RaycastWorld(Vector3 position, Vector3 direction, float length, int Count) | ||
3742 | { | ||
3743 | ContactResult[] ourResults = null; | ||
3744 | RayCallback retMethod = delegate(List<ContactResult> results) | ||
3745 | { | ||
3746 | ourResults = new ContactResult[results.Count]; | ||
3747 | results.CopyTo(ourResults, 0); | ||
3748 | }; | ||
3749 | int waitTime = 0; | ||
3750 | m_rayCastManager.QueueRequest(position, direction, length, Count, retMethod); | ||
3751 | while (ourResults == null && waitTime < 1000) | ||
3752 | { | ||
3753 | Thread.Sleep(1); | ||
3754 | waitTime++; | ||
3755 | } | ||
3756 | if (ourResults == null) | ||
3757 | return new List<ContactResult> (); | ||
3758 | return new List<ContactResult>(ourResults); | ||
3759 | } | ||
3760 | |||
3736 | #if USE_DRAWSTUFF | 3761 | #if USE_DRAWSTUFF |
3737 | // Keyboard callback | 3762 | // Keyboard callback |
3738 | public void command(int cmd) | 3763 | public void command(int cmd) |