diff options
author | Robert Adams | 2013-05-03 14:23:53 -0700 |
---|---|---|
committer | Robert Adams | 2013-05-03 14:23:53 -0700 |
commit | 5d25bb3084937d266375cba61b3a2c802bd57717 (patch) | |
tree | 73d291b1ed6b2368d1f23ca4d8e5f91f55885b0e /OpenSim | |
parent | BulletSim: prims with no cuts created with single convex hull shape. (diff) | |
download | opensim-SC-5d25bb3084937d266375cba61b3a2c802bd57717.zip opensim-SC-5d25bb3084937d266375cba61b3a2c802bd57717.tar.gz opensim-SC-5d25bb3084937d266375cba61b3a2c802bd57717.tar.bz2 opensim-SC-5d25bb3084937d266375cba61b3a2c802bd57717.tar.xz |
BulletSim: zero vehicle motion when changing vehicle type.
Rebuild compound linkset of any child in the linkset changes shape.
Comments and better detailed logging messages.
Diffstat (limited to 'OpenSim')
6 files changed, 18 insertions, 26 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index b9bd909..c5bee6d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -559,9 +559,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
559 | break; | 559 | break; |
560 | } | 560 | } |
561 | 561 | ||
562 | // Update any physical parameters based on this type. | ||
563 | Refresh(); | ||
564 | |||
565 | m_linearMotor = new BSVMotor("LinearMotor", m_linearMotorTimescale, | 562 | m_linearMotor = new BSVMotor("LinearMotor", m_linearMotorTimescale, |
566 | m_linearMotorDecayTimescale, m_linearFrictionTimescale, | 563 | m_linearMotorDecayTimescale, m_linearFrictionTimescale, |
567 | 1f); | 564 | 1f); |
@@ -589,6 +586,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
589 | { | 586 | { |
590 | RegisterForSceneEvents(); | 587 | RegisterForSceneEvents(); |
591 | } | 588 | } |
589 | |||
590 | // Update any physical parameters based on this type. | ||
591 | Refresh(); | ||
592 | } | 592 | } |
593 | #endregion // Vehicle parameter setting | 593 | #endregion // Vehicle parameter setting |
594 | 594 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 20eb871..1f16cc8 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -246,7 +246,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
246 | } | 246 | } |
247 | 247 | ||
248 | // Routine called when rebuilding the body of some member of the linkset. | 248 | // Routine called when rebuilding the body of some member of the linkset. |
249 | // Since we don't keep in world relationships, do nothing unless it's a child changing. | 249 | // If one of the bodies is being changed, the linkset needs rebuilding. |
250 | // For instance, a linkset is built and then a mesh asset is read in and the mesh is recreated. | ||
250 | // Returns 'true' of something was actually removed and would need restoring | 251 | // Returns 'true' of something was actually removed and would need restoring |
251 | // Called at taint-time!! | 252 | // Called at taint-time!! |
252 | public override bool RemoveDependencies(BSPrimLinkable child) | 253 | public override bool RemoveDependencies(BSPrimLinkable child) |
@@ -256,14 +257,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
256 | DetailLog("{0},BSLinksetCompound.RemoveBodyDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}", | 257 | DetailLog("{0},BSLinksetCompound.RemoveBodyDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}", |
257 | child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody, IsRoot(child)); | 258 | child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody, IsRoot(child)); |
258 | 259 | ||
259 | if (!IsRoot(child)) | 260 | ScheduleRebuild(child); |
260 | { | ||
261 | child.LinksetInfo = null; | ||
262 | } | ||
263 | |||
264 | // Cannot schedule a refresh/rebuild here because this routine is called when | ||
265 | // the linkset is being rebuilt. | ||
266 | // InternalRefresh(LinksetRoot); | ||
267 | 261 | ||
268 | return ret; | 262 | return ret; |
269 | } | 263 | } |
@@ -322,7 +316,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
322 | // Constraint linksets are rebuilt every time. | 316 | // Constraint linksets are rebuilt every time. |
323 | // Note that this works for rebuilding just the root after a linkset is taken apart. | 317 | // Note that this works for rebuilding just the root after a linkset is taken apart. |
324 | // Called at taint time!! | 318 | // Called at taint time!! |
325 | private bool UseBulletSimRootOffsetHack = false; | 319 | private bool UseBulletSimRootOffsetHack = false; // Attempt to have Bullet track the coords of root compound shape |
326 | private bool disableCOM = true; // For basic linkset debugging, turn off the center-of-mass setting | 320 | private bool disableCOM = true; // For basic linkset debugging, turn off the center-of-mass setting |
327 | private void RecomputeLinksetCompound() | 321 | private void RecomputeLinksetCompound() |
328 | { | 322 | { |
@@ -382,7 +376,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
382 | OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; | 376 | OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; |
383 | m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); | 377 | m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); |
384 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", | 378 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", |
385 | LinksetRoot.LocalID, memberIndex, cPrim.PhysShape, offsetPos, offsetRot); | 379 | LinksetRoot.LocalID, memberIndex, childShape, offsetPos, offsetRot); |
386 | 380 | ||
387 | // Since we are borrowing the shape of the child, disable the origional child body | 381 | // Since we are borrowing the shape of the child, disable the origional child body |
388 | if (!IsRoot(cPrim)) | 382 | if (!IsRoot(cPrim)) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 3d68d7f..d3f3475 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -511,7 +511,7 @@ public class BSPrim : BSPhysObject | |||
511 | 511 | ||
512 | PhysScene.TaintedObject("setVehicleType", delegate() | 512 | PhysScene.TaintedObject("setVehicleType", delegate() |
513 | { | 513 | { |
514 | // Vehicle code changes the parameters for this vehicle type. | 514 | ZeroMotion(true /* inTaintTime */); |
515 | VehicleActor.ProcessTypeChange(type); | 515 | VehicleActor.ProcessTypeChange(type); |
516 | ActivateIfPhysical(false); | 516 | ActivateIfPhysical(false); |
517 | }); | 517 | }); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs index 5236909..235da78 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs | |||
@@ -182,6 +182,10 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
182 | { | 182 | { |
183 | return false; | 183 | return false; |
184 | } | 184 | } |
185 | |||
186 | // TODO: handle collisions of other objects with with children of linkset. | ||
187 | // This is a problem for LinksetCompound since the children are packed into the root. | ||
188 | |||
185 | return base.Collide(collidingWith, collidee, contactPoint, contactNormal, pentrationDepth); | 189 | return base.Collide(collidingWith, collidee, contactPoint, contactNormal, pentrationDepth); |
186 | } | 190 | } |
187 | } | 191 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 794857c..64aaa15 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -254,10 +254,10 @@ public sealed class BSShapeCollection : IDisposable | |||
254 | } | 254 | } |
255 | else | 255 | else |
256 | { | 256 | { |
257 | // The current shape on the prim is the correct one. We don't need the potential reference. | ||
257 | potentialHull.Dereference(m_physicsScene); | 258 | potentialHull.Dereference(m_physicsScene); |
258 | } | 259 | } |
259 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,hull,shape={1},key={2}", | 260 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,hull,shape={1}", prim.LocalID, prim.PhysShape); |
260 | prim.LocalID, prim.PhysShape, prim.PhysShape.physShapeInfo.shapeKey.ToString("X")); | ||
261 | } | 261 | } |
262 | else | 262 | else |
263 | { | 263 | { |
@@ -277,8 +277,7 @@ public sealed class BSShapeCollection : IDisposable | |||
277 | // We don't need this reference to the mesh that is already being using. | 277 | // We don't need this reference to the mesh that is already being using. |
278 | potentialMesh.Dereference(m_physicsScene); | 278 | potentialMesh.Dereference(m_physicsScene); |
279 | } | 279 | } |
280 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,mesh,shape={1},key={2}", | 280 | if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,mesh,shape={1}", prim.LocalID, prim.PhysShape); |
281 | prim.LocalID, prim.PhysShape, prim.PhysShape.physShapeInfo.shapeKey.ToString("X")); | ||
282 | } | 281 | } |
283 | return ret; | 282 | return ret; |
284 | } | 283 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 9ef2923..3e4ee5a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |||
@@ -352,9 +352,6 @@ public class BSShapeMesh : BSShape | |||
352 | float lod; | 352 | float lod; |
353 | System.UInt64 newMeshKey = BSShape.ComputeShapeKey(prim.Size, prim.BaseShape, out lod); | 353 | System.UInt64 newMeshKey = BSShape.ComputeShapeKey(prim.Size, prim.BaseShape, out lod); |
354 | 354 | ||
355 | physicsScene.DetailLog("{0},BSShapeMesh,getReference,newKey={1},size={2},lod={3}", | ||
356 | prim.LocalID, newMeshKey.ToString("X"), prim.Size, lod); | ||
357 | |||
358 | BSShapeMesh retMesh = null; | 355 | BSShapeMesh retMesh = null; |
359 | lock (Meshes) | 356 | lock (Meshes) |
360 | { | 357 | { |
@@ -380,6 +377,7 @@ public class BSShapeMesh : BSShape | |||
380 | retMesh.physShapeInfo = newShape; | 377 | retMesh.physShapeInfo = newShape; |
381 | } | 378 | } |
382 | } | 379 | } |
380 | physicsScene.DetailLog("{0},BSShapeMesh,getReference,mesh={1},size={2},lod={3}", prim.LocalID, retMesh, prim.Size, lod); | ||
383 | return retMesh; | 381 | return retMesh; |
384 | } | 382 | } |
385 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) | 383 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) |
@@ -507,9 +505,6 @@ public class BSShapeHull : BSShape | |||
507 | float lod; | 505 | float lod; |
508 | System.UInt64 newHullKey = BSShape.ComputeShapeKey(prim.Size, prim.BaseShape, out lod); | 506 | System.UInt64 newHullKey = BSShape.ComputeShapeKey(prim.Size, prim.BaseShape, out lod); |
509 | 507 | ||
510 | physicsScene.DetailLog("{0},BSShapeHull,getReference,newKey={1},size={2},lod={3}", | ||
511 | prim.LocalID, newHullKey.ToString("X"), prim.Size, lod); | ||
512 | |||
513 | BSShapeHull retHull = null; | 508 | BSShapeHull retHull = null; |
514 | lock (Hulls) | 509 | lock (Hulls) |
515 | { | 510 | { |
@@ -531,10 +526,10 @@ public class BSShapeHull : BSShape | |||
531 | // If a mesh was what was created, remember the built shape for later sharing. | 526 | // If a mesh was what was created, remember the built shape for later sharing. |
532 | Hulls.Add(newHullKey, retHull); | 527 | Hulls.Add(newHullKey, retHull); |
533 | } | 528 | } |
534 | |||
535 | retHull.physShapeInfo = newShape; | 529 | retHull.physShapeInfo = newShape; |
536 | } | 530 | } |
537 | } | 531 | } |
532 | physicsScene.DetailLog("{0},BSShapeHull,getReference,hull={1},size={2},lod={3}", prim.LocalID, retHull, prim.Size, lod); | ||
538 | return retHull; | 533 | return retHull; |
539 | } | 534 | } |
540 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) | 535 | public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) |