aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsJoint.cs110
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs98
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs16
3 files changed, 112 insertions, 112 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
index 9ef1c84..9474ee4 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
@@ -1,55 +1,55 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.Physics.Manager
34{ 34{
35 public enum PhysicsJointType : int 35 public enum PhysicsJointType : int
36 { 36 {
37 Ball = 0, 37 Ball = 0,
38 Hinge = 1 38 Hinge = 1
39 } 39 }
40 40
41 public class PhysicsJoint 41 public class PhysicsJoint
42 { 42 {
43 public virtual bool IsInPhysicsEngine { get { return false; } } // set internally to indicate if this joint has already been passed to the physics engine or is still pending 43 public virtual bool IsInPhysicsEngine { get { return false; } } // set internally to indicate if this joint has already been passed to the physics engine or is still pending
44 public PhysicsJointType Type; 44 public PhysicsJointType Type;
45 public string RawParams; 45 public string RawParams;
46 public List<string> BodyNames = new List<string>(); 46 public List<string> BodyNames = new List<string>();
47 public PhysicsVector Position; // global coords 47 public PhysicsVector Position; // global coords
48 public Quaternion Rotation; // global coords 48 public Quaternion Rotation; // global coords
49 public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation 49 public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation
50 public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName) 50 public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName)
51 public Quaternion LocalRotation; // joint orientation relative to one of the involved bodies, the tracked body 51 public Quaternion LocalRotation; // joint orientation relative to one of the involved bodies, the tracked body
52 public int ErrorMessageCount; // total # of error messages printed for this joint since its creation. if too many, further error messages are suppressed to prevent flooding. 52 public int ErrorMessageCount; // total # of error messages printed for this joint since its creation. if too many, further error messages are suppressed to prevent flooding.
53 public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint 53 public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint
54 } 54 }
55} 55}
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs b/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs
index d080e9b..9858d6a 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs
@@ -1,49 +1,49 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using OpenMetaverse; 29using OpenMetaverse;
30using Ode.NET; 30using Ode.NET;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.Physics.Manager;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.Physics.Manager;
34using OpenSim.Region.Physics.OdePlugin; 34using OpenSim.Region.Physics.OdePlugin;
35 35
36namespace OpenSim.Region.Physics.OdePlugin 36namespace OpenSim.Region.Physics.OdePlugin
37{ 37{
38 class OdePhysicsJoint : PhysicsJoint 38 class OdePhysicsJoint : PhysicsJoint
39 { 39 {
40 public override bool IsInPhysicsEngine 40 public override bool IsInPhysicsEngine
41 { 41 {
42 get 42 get
43 { 43 {
44 return (jointID != IntPtr.Zero); 44 return (jointID != IntPtr.Zero);
45 } 45 }
46 } 46 }
47 public IntPtr jointID; 47 public IntPtr jointID;
48 } 48 }
49} 49}
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index acd2569..a250a6a 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1366,28 +1366,28 @@ namespace OpenSim.Region.Physics.OdePlugin
1366 get { return m_NINJA_physics_joints_enabled; } 1366 get { return m_NINJA_physics_joints_enabled; }
1367 } 1367 }
1368 1368
1369 // internal utility function: must be called within a lock(OdeLock) 1369 // internal utility function: must be called within a lock (OdeLock)
1370 private void InternalAddActiveJoint(PhysicsJoint joint) 1370 private void InternalAddActiveJoint(PhysicsJoint joint)
1371 { 1371 {
1372 activeJoints.Add(joint); 1372 activeJoints.Add(joint);
1373 SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint); 1373 SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint);
1374 } 1374 }
1375 1375
1376 // internal utility function: must be called within a lock(OdeLock) 1376 // internal utility function: must be called within a lock (OdeLock)
1377 private void InternalAddPendingJoint(OdePhysicsJoint joint) 1377 private void InternalAddPendingJoint(OdePhysicsJoint joint)
1378 { 1378 {
1379 pendingJoints.Add(joint); 1379 pendingJoints.Add(joint);
1380 SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint); 1380 SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint);
1381 } 1381 }
1382 1382
1383 // internal utility function: must be called within a lock(OdeLock) 1383 // internal utility function: must be called within a lock (OdeLock)
1384 private void InternalRemovePendingJoint(PhysicsJoint joint) 1384 private void InternalRemovePendingJoint(PhysicsJoint joint)
1385 { 1385 {
1386 pendingJoints.Remove(joint); 1386 pendingJoints.Remove(joint);
1387 SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene); 1387 SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene);
1388 } 1388 }
1389 1389
1390 // internal utility function: must be called within a lock(OdeLock) 1390 // internal utility function: must be called within a lock (OdeLock)
1391 private void InternalRemoveActiveJoint(PhysicsJoint joint) 1391 private void InternalRemoveActiveJoint(PhysicsJoint joint)
1392 { 1392 {
1393 activeJoints.Remove(joint); 1393 activeJoints.Remove(joint);
@@ -1640,7 +1640,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1640 } 1640 }
1641 } 1641 }
1642 1642
1643 // normally called from within OnJointMoved, which is called from within a lock(OdeLock) 1643 // normally called from within OnJointMoved, which is called from within a lock (OdeLock)
1644 public override PhysicsVector GetJointAnchor(PhysicsJoint joint) 1644 public override PhysicsVector GetJointAnchor(PhysicsJoint joint)
1645 { 1645 {
1646 Debug.Assert(joint.IsInPhysicsEngine); 1646 Debug.Assert(joint.IsInPhysicsEngine);
@@ -1666,7 +1666,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1666 return new PhysicsVector(pos.X, pos.Y, pos.Z); 1666 return new PhysicsVector(pos.X, pos.Y, pos.Z);
1667 } 1667 }
1668 1668
1669 // normally called from within OnJointMoved, which is called from within a lock(OdeLock) 1669 // normally called from within OnJointMoved, which is called from within a lock (OdeLock)
1670 // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function 1670 // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function
1671 // appears to be unreliable. Fortunately we can compute the joint axis ourselves by 1671 // appears to be unreliable. Fortunately we can compute the joint axis ourselves by
1672 // keeping track of the joint's original orientation relative to one of the involved bodies. 1672 // keeping track of the joint's original orientation relative to one of the involved bodies.
@@ -2230,8 +2230,8 @@ namespace OpenSim.Region.Physics.OdePlugin
2230 2230
2231 if (SupportsNINJAJoints) 2231 if (SupportsNINJAJoints)
2232 { 2232 {
2233 DeleteRequestedJoints(); // this must be outside of the lock(OdeLock) to avoid deadlocks 2233 DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2234 CreateRequestedJoints(); // this must be outside of the lock(OdeLock) to avoid deadlocks 2234 CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2235 } 2235 }
2236 2236
2237 lock (OdeLock) 2237 lock (OdeLock)