aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
diff options
context:
space:
mode:
authorRobert Adams2012-09-13 08:11:54 -0700
committerRobert Adams2012-09-15 15:31:29 -0700
commit2c5ff9399063080276a23bcd06fb696d653bef2e (patch)
tree3428eaff2697b562880c75f5f83eafcbb855c93e /OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
parentAdd basic asset connector tests to check behaviour for normal, local and temp... (diff)
downloadopensim-SC_OLD-2c5ff9399063080276a23bcd06fb696d653bef2e.zip
opensim-SC_OLD-2c5ff9399063080276a23bcd06fb696d653bef2e.tar.gz
opensim-SC_OLD-2c5ff9399063080276a23bcd06fb696d653bef2e.tar.bz2
opensim-SC_OLD-2c5ff9399063080276a23bcd06fb696d653bef2e.tar.xz
BulletSim: Way too many changes in one commit.
Many changes to BSDynamic for readability and commentary. Linkset hacking for vehicles: don't over mass the root prim. Add parameter for link constraint solver iterations. Correct uses of timestep in timescale calculations for vehicles. Reorganize code/logic for making objects static and dynamic for readability and use of API2. Changed most calls in BSPrim to use API2 calls (the new way). Avatars do not generate default Bullet collision events but do call up to the simulator for every avatar. Reduces overhead. Objects added to collision list only if they are processing collisions. Reduces overhead especially for large numbers of avatars. Generalize call for water height to GetWaterHeightAtXYZ(). Catch and correct exception getting terrain height when out of bounds. Correct race condition in Terrain Manager where creation wasn't at taint-time. Add API calls for constructing compound shapes. Move NeedsMeshing() logic into object class. Reorganize logic for object meshing to reduce rebuilding of meshs/hulls.
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs32
1 files changed, 25 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 5f6601d..dc1de6c 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -206,7 +206,7 @@ public class BSLinkset
206 // its internal properties. 206 // its internal properties.
207 public void Refresh(BSPhysObject requestor) 207 public void Refresh(BSPhysObject requestor)
208 { 208 {
209 // If there are no children, there aren't any constraints to recompute 209 // If there are no children, there can't be any constraints to recompute
210 if (!HasAnyChildren) 210 if (!HasAnyChildren)
211 return; 211 return;
212 212
@@ -225,11 +225,12 @@ public class BSLinkset
225 // from a linkset to make sure the constraints know about the new mass and 225 // from a linkset to make sure the constraints know about the new mass and
226 // geometry. 226 // geometry.
227 // Must only be called at taint time!! 227 // Must only be called at taint time!!
228 private bool RecomputeLinksetConstraintVariables() 228 private void RecomputeLinksetConstraintVariables()
229 { 229 {
230 float linksetMass = LinksetMass; 230 float linksetMass = LinksetMass;
231 lock (m_linksetActivityLock) 231 lock (m_linksetActivityLock)
232 { 232 {
233 bool somethingMissing = false;
233 foreach (BSPhysObject child in m_children) 234 foreach (BSPhysObject child in m_children)
234 { 235 {
235 BSConstraint constrain; 236 BSConstraint constrain;
@@ -241,16 +242,29 @@ public class BSLinkset
241 } 242 }
242 else 243 else
243 { 244 {
244 // Non-fatal error that can happen when children are being added to the linkset but 245 // Non-fatal error that happens when children are being added to the linkset but
245 // their constraints have not been created yet. 246 // their constraints have not been created yet.
246 // Caused by the fact that m_children is built at run time but building constraints 247 // Caused by the fact that m_children is built at run time but building constraints
247 // happens at taint time. 248 // happens at taint time.
248 // m_physicsScene.Logger.ErrorFormat("{0} RecomputeLinksetConstraintVariables: constraint not found for root={1}, child={2}", 249 somethingMissing = true;
249 // LogHeader, m_linksetRoot.Body.ID, child.Body.ID); 250 break;
250 } 251 }
251 } 252 }
253
254 // If the whole linkset is not here, doesn't make sense to recompute the root prim now.
255 if (!somethingMissing)
256 {
257 // The root prim takes on the weight of the whole linkset
258 /*
259 OMV.Vector3 inertia = BulletSimAPI.CalculateLocalInertia2(LinksetRoot.BSShape.Ptr, linksetMass);
260 BulletSimAPI.SetMassProps2(LinksetRoot.BSBody.Ptr, linksetMass, inertia);
261 OMV.Vector3 centerOfMass = ComputeLinksetCenterOfMass();
262 BulletSimAPI.SetCenterOfMassByPosRot2(LinksetRoot.BSBody.Ptr, centerOfMass, OMV.Quaternion.Identity);
263 BulletSimAPI.UpdateInertiaTensor2(LinksetRoot.BSBody.Ptr);
264 */
265 }
252 } 266 }
253 return false; 267 return;
254 } 268 }
255 269
256 // I am the root of a linkset and a new child is being added 270 // I am the root of a linkset and a new child is being added
@@ -296,9 +310,9 @@ public class BSLinkset
296 DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); 310 DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
297 311
298 PhysicallyUnlinkAChildFromRoot(rootx, childx); 312 PhysicallyUnlinkAChildFromRoot(rootx, childx);
313 RecomputeLinksetConstraintVariables();
299 }); 314 });
300 315
301 RecomputeLinksetConstraintVariables();
302 } 316 }
303 else 317 else
304 { 318 {
@@ -377,6 +391,10 @@ public class BSLinkset
377 PhysicsScene.Params.linkConstraintTransMotorMaxVel, 391 PhysicsScene.Params.linkConstraintTransMotorMaxVel,
378 PhysicsScene.Params.linkConstraintTransMotorMaxForce); 392 PhysicsScene.Params.linkConstraintTransMotorMaxForce);
379 constrain.SetCFMAndERP(PhysicsScene.Params.linkConstraintCFM, PhysicsScene.Params.linkConstraintERP); 393 constrain.SetCFMAndERP(PhysicsScene.Params.linkConstraintCFM, PhysicsScene.Params.linkConstraintERP);
394 if (PhysicsScene.Params.linkConstraintSolverIterations != 0f)
395 {
396 constrain.SetSolverIterations(PhysicsScene.Params.linkConstraintSolverIterations);
397 }
380 398
381 RecomputeLinksetConstraintVariables(); 399 RecomputeLinksetConstraintVariables();
382 } 400 }