aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
diff options
context:
space:
mode:
authorRobert Adams2012-11-03 18:26:00 -0700
committerRobert Adams2012-11-03 21:15:54 -0700
commit894bb4893b8bb269f8561737e4603a9b31183f2c (patch)
tree03a9af547b801be262b4c4f956aa3152db1e90f2 /OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
parentBulletSim: Move construction of compound linkset from ShapeCollection (diff)
downloadopensim-SC-894bb4893b8bb269f8561737e4603a9b31183f2c.zip
opensim-SC-894bb4893b8bb269f8561737e4603a9b31183f2c.tar.gz
opensim-SC-894bb4893b8bb269f8561737e4603a9b31183f2c.tar.bz2
opensim-SC-894bb4893b8bb269f8561737e4603a9b31183f2c.tar.xz
BulletSim: search the mesh and hull lists to find shapes if type is not known. This makes sure the correct accounting is done for the particular shape.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index adf4aff..6e68695 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -134,7 +134,7 @@ public sealed class BSLinksetCompound : BSLinkset
134 } 134 }
135 135
136 // Routine called when rebuilding the body of some member of the linkset. 136 // Routine called when rebuilding the body of some member of the linkset.
137 // Since we don't keep in-physical world relationships, do nothing unless it's a child changing. 137 // Since we don't keep in world relationships, do nothing unless it's a child changing.
138 // Returns 'true' of something was actually removed and would need restoring 138 // Returns 'true' of something was actually removed and would need restoring
139 // Called at taint-time!! 139 // Called at taint-time!!
140 public override bool RemoveBodyDependencies(BSPrim child) 140 public override bool RemoveBodyDependencies(BSPrim child)
@@ -221,10 +221,12 @@ public sealed class BSLinksetCompound : BSLinkset
221 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,start,rBody={1},rShape={2},numChildren={3}", 221 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,start,rBody={1},rShape={2},numChildren={3}",
222 LinksetRoot.LocalID, LinksetRoot.PhysBody, LinksetRoot.PhysShape, NumberOfChildren); 222 LinksetRoot.LocalID, LinksetRoot.PhysBody, LinksetRoot.PhysShape, NumberOfChildren);
223 223
224 // Add a shape for each of the other children in the linkset
224 ForEachMember(delegate(BSPhysObject cPrim) 225 ForEachMember(delegate(BSPhysObject cPrim)
225 { 226 {
226 if (!IsRoot(cPrim)) 227 if (!IsRoot(cPrim))
227 { 228 {
229 // Each child position and rotation is given relative to the root.
228 OMV.Quaternion invRootOrientation = OMV.Quaternion.Inverse(LinksetRoot.RawOrientation); 230 OMV.Quaternion invRootOrientation = OMV.Quaternion.Inverse(LinksetRoot.RawOrientation);
229 OMV.Vector3 displacementPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation; 231 OMV.Vector3 displacementPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation;
230 OMV.Quaternion displacementRot = cPrim.RawOrientation * invRootOrientation; 232 OMV.Quaternion displacementRot = cPrim.RawOrientation * invRootOrientation;
@@ -245,7 +247,7 @@ public sealed class BSLinksetCompound : BSLinkset
245 } 247 }
246 else 248 else
247 { 249 {
248 // For the shared shapes (meshes and hulls) just use the shape in the child 250 // For the shared shapes (meshes and hulls), just use the shape in the child.
249 if (PhysicsScene.Shapes.ReferenceShape(cPrim.PhysShape)) 251 if (PhysicsScene.Shapes.ReferenceShape(cPrim.PhysShape))
250 { 252 {
251 PhysicsScene.Logger.ErrorFormat("{0} Rebuilt sharable shape when building linkset! Region={1}, primID={2}, shape={3}", 253 PhysicsScene.Logger.ErrorFormat("{0} Rebuilt sharable shape when building linkset! Region={1}, primID={2}, shape={3}",
@@ -254,10 +256,10 @@ public sealed class BSLinksetCompound : BSLinkset
254 BulletSimAPI.AddChildShapeToCompoundShape2(LinksetRoot.PhysShape.ptr, cPrim.PhysShape.ptr, displacementPos, displacementRot); 256 BulletSimAPI.AddChildShapeToCompoundShape2(LinksetRoot.PhysShape.ptr, cPrim.PhysShape.ptr, displacementPos, displacementRot);
255 } 257 }
256 } 258 }
257 return false; 259 return false; // 'false' says to move onto the next child in the list
258 }); 260 });
259 261
260 262 // With all of the linkset packed into the root prim, it has the mass of everyone.
261 float linksetMass = LinksetMass; 263 float linksetMass = LinksetMass;
262 LinksetRoot.UpdatePhysicalMassProperties(linksetMass); 264 LinksetRoot.UpdatePhysicalMassProperties(linksetMass);
263 265