aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
diff options
context:
space:
mode:
authorRobert Adams2012-09-13 13:51:28 -0700
committerRobert Adams2012-09-15 15:31:49 -0700
commitf0a098924e8a3f64692de5d3326bfbdfb2b208a2 (patch)
treebfb702f3128b4ea6d19d9c8f415176aa4d885211 /OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
parentBulletSim: Add calls to linkset class when object going static or dynamic. (diff)
downloadopensim-SC_OLD-f0a098924e8a3f64692de5d3326bfbdfb2b208a2.zip
opensim-SC_OLD-f0a098924e8a3f64692de5d3326bfbdfb2b208a2.tar.gz
opensim-SC_OLD-f0a098924e8a3f64692de5d3326bfbdfb2b208a2.tar.bz2
opensim-SC_OLD-f0a098924e8a3f64692de5d3326bfbdfb2b208a2.tar.xz
BulletSim: set all linkset objects center of mass to the whole linkset's center of mass
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs17
1 files changed, 15 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 3d73887..7e784eb 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -204,11 +204,14 @@ public class BSLinkset
204 204
205 // The object is going dynamic (physical). Do any setup necessary 205 // The object is going dynamic (physical). Do any setup necessary
206 // for a dynamic linkset. 206 // for a dynamic linkset.
207 // Only the state of the passed object can be modified. The rest of the linkset
208 // has not yet been fully constructed.
207 // Return 'true' if any properties updated on the passed object. 209 // Return 'true' if any properties updated on the passed object.
208 // Called at taint-time! 210 // Called at taint-time!
209 public bool MakeDynamic(BSPhysObject child) 211 public bool MakeDynamic(BSPhysObject child)
210 { 212 {
211 return false; 213 bool ret = false;
214 return ret;
212 } 215 }
213 216
214 // The object is going static (non-physical). Do any setup necessary 217 // The object is going static (non-physical). Do any setup necessary
@@ -217,6 +220,7 @@ public class BSLinkset
217 // Called at taint-time! 220 // Called at taint-time!
218 public bool MakeStatic(BSPhysObject child) 221 public bool MakeStatic(BSPhysObject child)
219 { 222 {
223 // What is done for each object in BSPrim is what we want.
220 return false; 224 return false;
221 } 225 }
222 226
@@ -269,15 +273,24 @@ public class BSLinkset
269 } 273 }
270 } 274 }
271 275
272 // If the whole linkset is not here, doesn't make sense to recompute the root prim now. 276 // If the whole linkset is not here, doesn't make sense to recompute linkset wide values
273 if (!somethingMissing) 277 if (!somethingMissing)
274 { 278 {
279 // If this is a multiple object linkset, set everybody's center of mass to the set's center of mass
280 OMV.Vector3 centerOfMass = ComputeLinksetCenterOfMass();
281 BulletSimAPI.SetCenterOfMassByPosRot2(LinksetRoot.BSBody.Ptr, centerOfMass, OMV.Quaternion.Identity);
282 foreach (BSPhysObject child in m_children)
283 {
284 BulletSimAPI.SetCenterOfMassByPosRot2(child.BSBody.Ptr, centerOfMass, OMV.Quaternion.Identity);
285 }
286 /*
275 // The root prim takes on the weight of the whole linkset 287 // The root prim takes on the weight of the whole linkset
276 OMV.Vector3 inertia = BulletSimAPI.CalculateLocalInertia2(LinksetRoot.BSShape.Ptr, linksetMass); 288 OMV.Vector3 inertia = BulletSimAPI.CalculateLocalInertia2(LinksetRoot.BSShape.Ptr, linksetMass);
277 BulletSimAPI.SetMassProps2(LinksetRoot.BSBody.Ptr, linksetMass, inertia); 289 BulletSimAPI.SetMassProps2(LinksetRoot.BSBody.Ptr, linksetMass, inertia);
278 OMV.Vector3 centerOfMass = ComputeLinksetCenterOfMass(); 290 OMV.Vector3 centerOfMass = ComputeLinksetCenterOfMass();
279 BulletSimAPI.SetCenterOfMassByPosRot2(LinksetRoot.BSBody.Ptr, centerOfMass, OMV.Quaternion.Identity); 291 BulletSimAPI.SetCenterOfMassByPosRot2(LinksetRoot.BSBody.Ptr, centerOfMass, OMV.Quaternion.Identity);
280 BulletSimAPI.UpdateInertiaTensor2(LinksetRoot.BSBody.Ptr); 292 BulletSimAPI.UpdateInertiaTensor2(LinksetRoot.BSBody.Ptr);
293 */
281 } 294 }
282 } 295 }
283 return; 296 return;