aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2013-05-03 15:46:35 -0700
committerRobert Adams2013-05-06 13:32:22 -0700
commitf9fb1484aa00f8bfadead06ce71d004502fb564e (patch)
treea8af22458ad7f191a9736ce0531fbf30c5d4987b /OpenSim/Region/Physics
parentAdded new method to Remote Admin for reloading the estate settings. This is m... (diff)
downloadopensim-SC_OLD-f9fb1484aa00f8bfadead06ce71d004502fb564e.zip
opensim-SC_OLD-f9fb1484aa00f8bfadead06ce71d004502fb564e.tar.gz
opensim-SC_OLD-f9fb1484aa00f8bfadead06ce71d004502fb564e.tar.bz2
opensim-SC_OLD-f9fb1484aa00f8bfadead06ce71d004502fb564e.tar.xz
BulletSim: extend BSActorLockAxis to allow locking linear movement in
addition to angular movement. Not enabled by anything yet.
Diffstat (limited to 'OpenSim/Region/Physics')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs25
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs9
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs4
3 files changed, 28 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
index 7801d8e..8b0fdeb 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
@@ -64,9 +64,9 @@ public class BSActorLockAxis : BSActor
64 public override void Refresh() 64 public override void Refresh()
65 { 65 {
66 m_physicsScene.DetailLog("{0},BSActorLockAxis,refresh,lockedAxis={1},enabled={2},pActive={3}", 66 m_physicsScene.DetailLog("{0},BSActorLockAxis,refresh,lockedAxis={1},enabled={2},pActive={3}",
67 m_controllingPrim.LocalID, m_controllingPrim.LockedAxis, Enabled, m_controllingPrim.IsPhysicallyActive); 67 m_controllingPrim.LocalID, m_controllingPrim.LockedAngularAxis, Enabled, m_controllingPrim.IsPhysicallyActive);
68 // If all the axis are free, we don't need to exist 68 // If all the axis are free, we don't need to exist
69 if (m_controllingPrim.LockedAxis == m_controllingPrim.LockedAxisFree) 69 if (m_controllingPrim.LockedAngularAxis == m_controllingPrim.LockedAxisFree)
70 { 70 {
71 Enabled = false; 71 Enabled = false;
72 } 72 }
@@ -123,23 +123,38 @@ public class BSActorLockAxis : BSActor
123 // Free to move linearly in the region 123 // Free to move linearly in the region
124 OMV.Vector3 linearLow = OMV.Vector3.Zero; 124 OMV.Vector3 linearLow = OMV.Vector3.Zero;
125 OMV.Vector3 linearHigh = m_physicsScene.TerrainManager.DefaultRegionSize; 125 OMV.Vector3 linearHigh = m_physicsScene.TerrainManager.DefaultRegionSize;
126 if (m_controllingPrim.LockedLinearAxis.X != BSPhysObject.FreeAxis)
127 {
128 linearLow.X = m_controllingPrim.RawPosition.X;
129 linearHigh.X = m_controllingPrim.RawPosition.X;
130 }
131 if (m_controllingPrim.LockedLinearAxis.Y != BSPhysObject.FreeAxis)
132 {
133 linearLow.Y = m_controllingPrim.RawPosition.Y;
134 linearHigh.Y = m_controllingPrim.RawPosition.Y;
135 }
136 if (m_controllingPrim.LockedLinearAxis.Z != BSPhysObject.FreeAxis)
137 {
138 linearLow.Z = m_controllingPrim.RawPosition.Z;
139 linearHigh.Z = m_controllingPrim.RawPosition.Z;
140 }
126 axisConstrainer.SetLinearLimits(linearLow, linearHigh); 141 axisConstrainer.SetLinearLimits(linearLow, linearHigh);
127 142
128 // Angular with some axis locked 143 // Angular with some axis locked
129 float fPI = (float)Math.PI; 144 float fPI = (float)Math.PI;
130 OMV.Vector3 angularLow = new OMV.Vector3(-fPI, -fPI, -fPI); 145 OMV.Vector3 angularLow = new OMV.Vector3(-fPI, -fPI, -fPI);
131 OMV.Vector3 angularHigh = new OMV.Vector3(fPI, fPI, fPI); 146 OMV.Vector3 angularHigh = new OMV.Vector3(fPI, fPI, fPI);
132 if (m_controllingPrim.LockedAxis.X != 1f) 147 if (m_controllingPrim.LockedAngularAxis.X != BSPhysObject.FreeAxis)
133 { 148 {
134 angularLow.X = 0f; 149 angularLow.X = 0f;
135 angularHigh.X = 0f; 150 angularHigh.X = 0f;
136 } 151 }
137 if (m_controllingPrim.LockedAxis.Y != 1f) 152 if (m_controllingPrim.LockedAngularAxis.Y != BSPhysObject.FreeAxis)
138 { 153 {
139 angularLow.Y = 0f; 154 angularLow.Y = 0f;
140 angularHigh.Y = 0f; 155 angularHigh.Y = 0f;
141 } 156 }
142 if (m_controllingPrim.LockedAxis.Z != 1f) 157 if (m_controllingPrim.LockedAngularAxis.Z != BSPhysObject.FreeAxis)
143 { 158 {
144 angularLow.Z = 0f; 159 angularLow.Z = 0f;
145 angularHigh.Z = 0f; 160 angularHigh.Z = 0f;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index e796804..cca887a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -108,7 +108,8 @@ public abstract class BSPhysObject : PhysicsActor
108 CollisionScore = 0; 108 CollisionScore = 0;
109 109
110 // All axis free. 110 // All axis free.
111 LockedAxis = LockedAxisFree; 111 LockedLinearAxis = LockedAxisFree;
112 LockedAngularAxis = LockedAxisFree;
112 } 113 }
113 114
114 // Tell the object to clean up. 115 // Tell the object to clean up.
@@ -265,8 +266,10 @@ public abstract class BSPhysObject : PhysicsActor
265 // Note this is a displacement from the root's coordinates. Zero means use the root prim as center-of-mass. 266 // Note this is a displacement from the root's coordinates. Zero means use the root prim as center-of-mass.
266 public OMV.Vector3? UserSetCenterOfMassDisplacement { get; set; } 267 public OMV.Vector3? UserSetCenterOfMassDisplacement { get; set; }
267 268
268 public OMV.Vector3 LockedAxis { get; set; } // zero means locked. one means free. 269 public OMV.Vector3 LockedLinearAxis { get; set; } // zero means locked. one means free.
269 public readonly OMV.Vector3 LockedAxisFree = new OMV.Vector3(1f, 1f, 1f); // All axis are free 270 public OMV.Vector3 LockedAngularAxis { get; set; } // zero means locked. one means free.
271 public const float FreeAxis = 1f;
272 public readonly OMV.Vector3 LockedAxisFree = new OMV.Vector3(FreeAxis, FreeAxis, FreeAxis); // All axis are free
270 273
271 // Enable physical actions. Bullet will keep sleeping non-moving physical objects so 274 // Enable physical actions. Bullet will keep sleeping non-moving physical objects so
272 // they need waking up when parameters are changed. 275 // they need waking up when parameters are changed.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index d3f3475..f5b0361 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -256,9 +256,9 @@ public class BSPrim : BSPhysObject
256 if (axis.X != 1) locking.X = 0f; 256 if (axis.X != 1) locking.X = 0f;
257 if (axis.Y != 1) locking.Y = 0f; 257 if (axis.Y != 1) locking.Y = 0f;
258 if (axis.Z != 1) locking.Z = 0f; 258 if (axis.Z != 1) locking.Z = 0f;
259 LockedAxis = locking; 259 LockedAngularAxis = locking;
260 260
261 EnableActor(LockedAxis != LockedAxisFree, LockedAxisActorName, delegate() 261 EnableActor(LockedAngularAxis != LockedAxisFree, LockedAxisActorName, delegate()
262 { 262 {
263 return new BSActorLockAxis(PhysScene, this, LockedAxisActorName); 263 return new BSActorLockAxis(PhysScene, this, LockedAxisActorName);
264 }); 264 });