diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 0eb0c45..2f42646 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -684,7 +684,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
684 | /// </summary> | 684 | /// </summary> |
685 | /// <param name="pos"></param> | 685 | /// <param name="pos"></param> |
686 | /// <returns>Returns which split up space the given position is in.</returns> | 686 | /// <returns>Returns which split up space the given position is in.</returns> |
687 | public string whichspaceamIin(PhysicsVector pos) | 687 | public string whichspaceamIin(Vector3 pos) |
688 | { | 688 | { |
689 | return calculateSpaceForGeom(pos).ToString(); | 689 | return calculateSpaceForGeom(pos).ToString(); |
690 | } | 690 | } |
@@ -963,7 +963,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
963 | 963 | ||
964 | //p2.CollidingObj = true; | 964 | //p2.CollidingObj = true; |
965 | contacts[i].depth = 0.00000003f; | 965 | contacts[i].depth = 0.00000003f; |
966 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f); | 966 | p2.Velocity = p2.Velocity + new Vector3(0f, 0f, 0.5f); |
967 | contacts[i].pos = | 967 | contacts[i].pos = |
968 | new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), | 968 | new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), |
969 | contacts[i].pos.Y + (p1.Size.Y/2), | 969 | contacts[i].pos.Y + (p1.Size.Y/2), |
@@ -981,7 +981,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
981 | 981 | ||
982 | //p2.CollidingObj = true; | 982 | //p2.CollidingObj = true; |
983 | contacts[i].depth = 0.00000003f; | 983 | contacts[i].depth = 0.00000003f; |
984 | p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 0.5f); | 984 | p1.Velocity = p1.Velocity + new Vector3(0f, 0f, 0.5f); |
985 | contacts[i].pos = | 985 | contacts[i].pos = |
986 | new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), | 986 | new d.Vector3(contacts[i].pos.X + (p1.Size.X/2), |
987 | contacts[i].pos.Y + (p1.Size.Y/2), | 987 | contacts[i].pos.Y + (p1.Size.Y/2), |
@@ -1646,9 +1646,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1646 | 1646 | ||
1647 | #region Add/Remove Entities | 1647 | #region Add/Remove Entities |
1648 | 1648 | ||
1649 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) | 1649 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
1650 | { | 1650 | { |
1651 | PhysicsVector pos = new PhysicsVector(); | 1651 | Vector3 pos; |
1652 | pos.X = position.X; | 1652 | pos.X = position.X; |
1653 | pos.Y = position.Y; | 1653 | pos.Y = position.Y; |
1654 | pos.Z = position.Z; | 1654 | pos.Z = position.Z; |
@@ -1698,18 +1698,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1698 | 1698 | ||
1699 | } | 1699 | } |
1700 | 1700 | ||
1701 | private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, | 1701 | private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, |
1702 | IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) | 1702 | IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) |
1703 | { | 1703 | { |
1704 | 1704 | ||
1705 | PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z); | 1705 | Vector3 pos = position; |
1706 | //pos.X = position.X; | 1706 | Vector3 siz = size; |
1707 | //pos.Y = position.Y; | ||
1708 | //pos.Z = position.Z; | ||
1709 | PhysicsVector siz = new PhysicsVector(); | ||
1710 | siz.X = size.X; | ||
1711 | siz.Y = size.Y; | ||
1712 | siz.Z = size.Z; | ||
1713 | Quaternion rot = rotation; | 1707 | Quaternion rot = rotation; |
1714 | 1708 | ||
1715 | OdePrim newPrim; | 1709 | OdePrim newPrim; |
@@ -1736,14 +1730,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1736 | } | 1730 | } |
1737 | } | 1731 | } |
1738 | 1732 | ||
1739 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 1733 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
1740 | PhysicsVector size, Quaternion rotation) //To be removed | 1734 | Vector3 size, Quaternion rotation) //To be removed |
1741 | { | 1735 | { |
1742 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 1736 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
1743 | } | 1737 | } |
1744 | 1738 | ||
1745 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 1739 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
1746 | PhysicsVector size, Quaternion rotation, bool isPhysical) | 1740 | Vector3 size, Quaternion rotation, bool isPhysical) |
1747 | { | 1741 | { |
1748 | PhysicsActor result; | 1742 | PhysicsActor result; |
1749 | IMesh mesh = null; | 1743 | IMesh mesh = null; |
@@ -1976,7 +1970,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1976 | // this joint will just be added to a waiting list that is NOT processed during the main | 1970 | // this joint will just be added to a waiting list that is NOT processed during the main |
1977 | // Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests. | 1971 | // Simulate() loop (to avoid deadlocks). After Simulate() is finished, we handle unprocessed joint requests. |
1978 | 1972 | ||
1979 | public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, PhysicsVector position, | 1973 | public override PhysicsJoint RequestJointCreation(string objectNameInScene, PhysicsJointType jointType, Vector3 position, |
1980 | Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation) | 1974 | Quaternion rotation, string parms, List<string> bodyNames, string trackedBodyName, Quaternion localRotation) |
1981 | 1975 | ||
1982 | { | 1976 | { |
@@ -1984,7 +1978,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1984 | OdePhysicsJoint joint = new OdePhysicsJoint(); | 1978 | OdePhysicsJoint joint = new OdePhysicsJoint(); |
1985 | joint.ObjectNameInScene = objectNameInScene; | 1979 | joint.ObjectNameInScene = objectNameInScene; |
1986 | joint.Type = jointType; | 1980 | joint.Type = jointType; |
1987 | joint.Position = new PhysicsVector(position.X, position.Y, position.Z); | 1981 | joint.Position = position; |
1988 | joint.Rotation = rotation; | 1982 | joint.Rotation = rotation; |
1989 | joint.RawParams = parms; | 1983 | joint.RawParams = parms; |
1990 | joint.BodyNames = new List<string>(bodyNames); | 1984 | joint.BodyNames = new List<string>(bodyNames); |
@@ -2036,7 +2030,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2036 | } | 2030 | } |
2037 | 2031 | ||
2038 | // normally called from within OnJointMoved, which is called from within a lock (OdeLock) | 2032 | // normally called from within OnJointMoved, which is called from within a lock (OdeLock) |
2039 | public override PhysicsVector GetJointAnchor(PhysicsJoint joint) | 2033 | public override Vector3 GetJointAnchor(PhysicsJoint joint) |
2040 | { | 2034 | { |
2041 | Debug.Assert(joint.IsInPhysicsEngine); | 2035 | Debug.Assert(joint.IsInPhysicsEngine); |
2042 | d.Vector3 pos = new d.Vector3(); | 2036 | d.Vector3 pos = new d.Vector3(); |
@@ -2058,14 +2052,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2058 | break; | 2052 | break; |
2059 | } | 2053 | } |
2060 | } | 2054 | } |
2061 | return new PhysicsVector(pos.X, pos.Y, pos.Z); | 2055 | return new Vector3(pos.X, pos.Y, pos.Z); |
2062 | } | 2056 | } |
2063 | 2057 | ||
2064 | // normally called from within OnJointMoved, which is called from within a lock (OdeLock) | 2058 | // normally called from within OnJointMoved, which is called from within a lock (OdeLock) |
2065 | // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function | 2059 | // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function |
2066 | // appears to be unreliable. Fortunately we can compute the joint axis ourselves by | 2060 | // appears to be unreliable. Fortunately we can compute the joint axis ourselves by |
2067 | // keeping track of the joint's original orientation relative to one of the involved bodies. | 2061 | // keeping track of the joint's original orientation relative to one of the involved bodies. |
2068 | public override PhysicsVector GetJointAxis(PhysicsJoint joint) | 2062 | public override Vector3 GetJointAxis(PhysicsJoint joint) |
2069 | { | 2063 | { |
2070 | Debug.Assert(joint.IsInPhysicsEngine); | 2064 | Debug.Assert(joint.IsInPhysicsEngine); |
2071 | d.Vector3 axis = new d.Vector3(); | 2065 | d.Vector3 axis = new d.Vector3(); |
@@ -2087,7 +2081,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2087 | break; | 2081 | break; |
2088 | } | 2082 | } |
2089 | } | 2083 | } |
2090 | return new PhysicsVector(axis.X, axis.Y, axis.Z); | 2084 | return new Vector3(axis.X, axis.Y, axis.Z); |
2091 | } | 2085 | } |
2092 | 2086 | ||
2093 | 2087 | ||
@@ -2255,7 +2249,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2255 | /// <param name="pos">the position that the geom moved to</param> | 2249 | /// <param name="pos">the position that the geom moved to</param> |
2256 | /// <param name="currentspace">a pointer to the space it was in before it was moved.</param> | 2250 | /// <param name="currentspace">a pointer to the space it was in before it was moved.</param> |
2257 | /// <returns>a pointer to the new space it's in</returns> | 2251 | /// <returns>a pointer to the new space it's in</returns> |
2258 | public IntPtr recalculateSpaceForGeom(IntPtr geom, PhysicsVector pos, IntPtr currentspace) | 2252 | public IntPtr recalculateSpaceForGeom(IntPtr geom, Vector3 pos, IntPtr currentspace) |
2259 | { | 2253 | { |
2260 | // Called from setting the Position and Size of an ODEPrim so | 2254 | // Called from setting the Position and Size of an ODEPrim so |
2261 | // it's already in locked space. | 2255 | // it's already in locked space. |
@@ -2402,7 +2396,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2402 | /// </summary> | 2396 | /// </summary> |
2403 | /// <param name="pos"></param> | 2397 | /// <param name="pos"></param> |
2404 | /// <returns>a pointer to the space. This could be a new space or reused space.</returns> | 2398 | /// <returns>a pointer to the space. This could be a new space or reused space.</returns> |
2405 | public IntPtr calculateSpaceForGeom(PhysicsVector pos) | 2399 | public IntPtr calculateSpaceForGeom(Vector3 pos) |
2406 | { | 2400 | { |
2407 | int[] xyspace = calculateSpaceArrayItemFromPos(pos); | 2401 | int[] xyspace = calculateSpaceArrayItemFromPos(pos); |
2408 | //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); | 2402 | //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); |
@@ -2414,7 +2408,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2414 | /// </summary> | 2408 | /// </summary> |
2415 | /// <param name="pos"></param> | 2409 | /// <param name="pos"></param> |
2416 | /// <returns>an array item based on the position</returns> | 2410 | /// <returns>an array item based on the position</returns> |
2417 | public int[] calculateSpaceArrayItemFromPos(PhysicsVector pos) | 2411 | public int[] calculateSpaceArrayItemFromPos(Vector3 pos) |
2418 | { | 2412 | { |
2419 | int[] returnint = new int[2]; | 2413 | int[] returnint = new int[2]; |
2420 | 2414 | ||