aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
diff options
context:
space:
mode:
authorRobert Adams2012-10-31 14:49:28 -0700
committerRobert Adams2012-11-03 21:15:06 -0700
commit364a7c308804a3e331199ca60c6dfafa406b5d0d (patch)
treef9755f07a181265c57542d3df19879c20a924947 /OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
parentBulletSim: vehicle tweeking. (diff)
downloadopensim-SC_OLD-364a7c308804a3e331199ca60c6dfafa406b5d0d.zip
opensim-SC_OLD-364a7c308804a3e331199ca60c6dfafa406b5d0d.tar.gz
opensim-SC_OLD-364a7c308804a3e331199ca60c6dfafa406b5d0d.tar.bz2
opensim-SC_OLD-364a7c308804a3e331199ca60c6dfafa406b5d0d.tar.xz
BulletSim: rename BSBody and BSShape to PhysBody and PhysShape. Add skeleton of BSLinksetCompound.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs40
1 files changed, 13 insertions, 27 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
index 8cdbd9b..65aed77 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
@@ -94,7 +94,7 @@ public sealed class BSLinksetConstraints : BSLinkset
94 bool ret = false; 94 bool ret = false;
95 95
96 DetailLog("{0},BSLinksetConstraint.RemoveBodyDependencies,removeChildrenForRoot,rID={1},rBody={2}", 96 DetailLog("{0},BSLinksetConstraint.RemoveBodyDependencies,removeChildrenForRoot,rID={1},rBody={2}",
97 child.LocalID, LinksetRoot.LocalID, LinksetRoot.BSBody.ptr.ToString("X")); 97 child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X"));
98 98
99 lock (m_linksetActivityLock) 99 lock (m_linksetActivityLock)
100 { 100 {
@@ -124,9 +124,6 @@ public sealed class BSLinksetConstraints : BSLinkset
124 { 124 {
125 m_children.Add(child); 125 m_children.Add(child);
126 126
127 BSPhysObject rootx = LinksetRoot; // capture the root as of now
128 BSPhysObject childx = child;
129
130 DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); 127 DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
131 128
132 // Cause constraints and assorted properties to be recomputed before the next simulation step. 129 // Cause constraints and assorted properties to be recomputed before the next simulation step.
@@ -135,17 +132,6 @@ public sealed class BSLinksetConstraints : BSLinkset
135 return; 132 return;
136 } 133 }
137 134
138 // Forcefully removing a child from a linkset.
139 // This is not being called by the child so we have to make sure the child doesn't think
140 // it's still connected to the linkset.
141 // Normal OpenSimulator operation will never do this because other SceneObjectPart information
142 // also has to be updated (like pointer to prim's parent).
143 protected override void RemoveChildFromOtherLinkset(BSPhysObject pchild)
144 {
145 pchild.Linkset = BSLinkset.Factory(PhysicsScene, pchild);
146 RemoveChildFromLinkset(pchild);
147 }
148
149 // Remove the specified child from the linkset. 135 // Remove the specified child from the linkset.
150 // Safe to call even if the child is not really in my linkset. 136 // Safe to call even if the child is not really in my linkset.
151 protected override void RemoveChildFromLinkset(BSPhysObject child) 137 protected override void RemoveChildFromLinkset(BSPhysObject child)
@@ -157,8 +143,8 @@ public sealed class BSLinksetConstraints : BSLinkset
157 143
158 DetailLog("{0},BSLinksetConstraints.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}", 144 DetailLog("{0},BSLinksetConstraints.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}",
159 childx.LocalID, 145 childx.LocalID,
160 rootx.LocalID, rootx.BSBody.ptr.ToString("X"), 146 rootx.LocalID, rootx.PhysBody.ptr.ToString("X"),
161 childx.LocalID, childx.BSBody.ptr.ToString("X")); 147 childx.LocalID, childx.PhysBody.ptr.ToString("X"));
162 148
163 PhysicsScene.TaintedObject("BSLinksetConstraints.RemoveChildFromLinkset", delegate() 149 PhysicsScene.TaintedObject("BSLinksetConstraints.RemoveChildFromLinkset", delegate()
164 { 150 {
@@ -197,15 +183,15 @@ public sealed class BSLinksetConstraints : BSLinkset
197 183
198 DetailLog("{0},BSLinksetConstraint.BuildConstraint,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}", 184 DetailLog("{0},BSLinksetConstraint.BuildConstraint,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}",
199 rootPrim.LocalID, 185 rootPrim.LocalID,
200 rootPrim.LocalID, rootPrim.BSBody.ptr.ToString("X"), 186 rootPrim.LocalID, rootPrim.PhysBody.ptr.ToString("X"),
201 childPrim.LocalID, childPrim.BSBody.ptr.ToString("X"), 187 childPrim.LocalID, childPrim.PhysBody.ptr.ToString("X"),
202 rootPrim.Position, childPrim.Position, midPoint); 188 rootPrim.Position, childPrim.Position, midPoint);
203 189
204 // create a constraint that allows no freedom of movement between the two objects 190 // create a constraint that allows no freedom of movement between the two objects
205 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818 191 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
206 192
207 BSConstraint6Dof constrain = new BSConstraint6Dof( 193 BSConstraint6Dof constrain = new BSConstraint6Dof(
208 PhysicsScene.World, rootPrim.BSBody, childPrim.BSBody, midPoint, true, true ); 194 PhysicsScene.World, rootPrim.PhysBody, childPrim.PhysBody, midPoint, true, true );
209 // PhysicsScene.World, childPrim.BSBody, rootPrim.BSBody, midPoint, true, true ); 195 // PhysicsScene.World, childPrim.BSBody, rootPrim.BSBody, midPoint, true, true );
210 196
211 /* NOTE: below is an attempt to build constraint with full frame computation, etc. 197 /* NOTE: below is an attempt to build constraint with full frame computation, etc.
@@ -262,14 +248,14 @@ public sealed class BSLinksetConstraints : BSLinkset
262 bool ret = false; 248 bool ret = false;
263 DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAChildFromRoot,taint,root={1},rBody={2},child={3},cBody={4}", 249 DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAChildFromRoot,taint,root={1},rBody={2},child={3},cBody={4}",
264 rootPrim.LocalID, 250 rootPrim.LocalID,
265 rootPrim.LocalID, rootPrim.BSBody.ptr.ToString("X"), 251 rootPrim.LocalID, rootPrim.PhysBody.ptr.ToString("X"),
266 childPrim.LocalID, childPrim.BSBody.ptr.ToString("X")); 252 childPrim.LocalID, childPrim.PhysBody.ptr.ToString("X"));
267 253
268 // Find the constraint for this link and get rid of it from the overall collection and from my list 254 // Find the constraint for this link and get rid of it from the overall collection and from my list
269 if (PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.BSBody, childPrim.BSBody)) 255 if (PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody, childPrim.PhysBody))
270 { 256 {
271 // Make the child refresh its location 257 // Make the child refresh its location
272 BulletSimAPI.PushUpdate2(childPrim.BSBody.ptr); 258 BulletSimAPI.PushUpdate2(childPrim.PhysBody.ptr);
273 ret = true; 259 ret = true;
274 } 260 }
275 261
@@ -283,7 +269,7 @@ public sealed class BSLinksetConstraints : BSLinkset
283 { 269 {
284 DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID); 270 DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID);
285 271
286 return PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.BSBody); 272 return PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody);
287 } 273 }
288 274
289 // Call each of the constraints that make up this linkset and recompute the 275 // Call each of the constraints that make up this linkset and recompute the
@@ -300,7 +286,7 @@ public sealed class BSLinksetConstraints : BSLinkset
300 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, 286 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr,
301 // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask); 287 // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask);
302 DetailLog("{0},BSLinksetConstraint.RecomputeLinksetConstraints,set,rBody={1},linksetMass={2}", 288 DetailLog("{0},BSLinksetConstraint.RecomputeLinksetConstraints,set,rBody={1},linksetMass={2}",
303 LinksetRoot.LocalID, LinksetRoot.BSBody.ptr.ToString("X"), linksetMass); 289 LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X"), linksetMass);
304 290
305 foreach (BSPhysObject child in m_children) 291 foreach (BSPhysObject child in m_children)
306 { 292 {
@@ -310,7 +296,7 @@ public sealed class BSLinksetConstraints : BSLinkset
310 child.UpdatePhysicalMassProperties(linksetMass); 296 child.UpdatePhysicalMassProperties(linksetMass);
311 297
312 BSConstraint constrain; 298 BSConstraint constrain;
313 if (!PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.BSBody, child.BSBody, out constrain)) 299 if (!PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.PhysBody, child.PhysBody, out constrain))
314 { 300 {
315 // If constraint doesn't exist yet, create it. 301 // If constraint doesn't exist yet, create it.
316 constrain = BuildConstraint(LinksetRoot, child); 302 constrain = BuildConstraint(LinksetRoot, child);