diff options
author | Robert Adams | 2012-12-09 22:32:13 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-09 22:32:46 -0800 |
commit | a19896cc569c037436ad8e65f044224f169d63d4 (patch) | |
tree | 032898c915051b12be02c9cba354fe3a7edabba5 | |
parent | BulletSim: adjust friction and restitution based on material type. (diff) | |
download | opensim-SC-a19896cc569c037436ad8e65f044224f169d63d4.zip opensim-SC-a19896cc569c037436ad8e65f044224f169d63d4.tar.gz opensim-SC-a19896cc569c037436ad8e65f044224f169d63d4.tar.bz2 opensim-SC-a19896cc569c037436ad8e65f044224f169d63d4.tar.xz |
BulletSim: some comments about rebuilding linksets (having to recompute and restore a child's position in the world based on its position in the moved linkset).
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 1f7c398..bc9f9be 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -192,6 +192,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
192 | child.LocalID, child.PhysBody.ptr.ToString("X")); | 192 | child.LocalID, child.PhysBody.ptr.ToString("X")); |
193 | 193 | ||
194 | // Cause the child's body to be rebuilt and thus restored to normal operation | 194 | // Cause the child's body to be rebuilt and thus restored to normal operation |
195 | // TODO: position and rotation must be restored because the child could have moved | ||
196 | // based on the linkset. | ||
195 | child.ForceBodyShapeRebuild(false); | 197 | child.ForceBodyShapeRebuild(false); |
196 | 198 | ||
197 | if (!HasAnyChildren) | 199 | if (!HasAnyChildren) |
@@ -236,9 +238,10 @@ public sealed class BSLinksetCompound : BSLinkset | |||
236 | 238 | ||
237 | if (cPrim.PhysShape.isNativeShape) | 239 | if (cPrim.PhysShape.isNativeShape) |
238 | { | 240 | { |
239 | // Native shapes are not shared so we need to create a new one. | 241 | // A native shape is turning into a null collision shape because native |
240 | // A mesh or hull is created because scale is not available on a native shape. | 242 | // shapes are not shared so we have to hullify it so it will be tracked |
241 | // (TODO: Bullet does have a btScaledCollisionShape. Can that be used?) | 243 | // and freed at the correct time. This also solves the scaling problem |
244 | // (native shapes scaled but hull/meshes are assumed to not be). | ||
242 | BulletShape saveShape = cPrim.PhysShape; | 245 | BulletShape saveShape = cPrim.PhysShape; |
243 | cPrim.PhysShape.ptr = IntPtr.Zero; // Don't let the create free the child's shape | 246 | cPrim.PhysShape.ptr = IntPtr.Zero; // Don't let the create free the child's shape |
244 | PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null); | 247 | PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null); |