aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorRobert Adams2014-06-08 09:03:38 -0700
committerRobert Adams2014-06-08 09:03:38 -0700
commit3552cfb1a520d75211ed88b38342d9b141c46d28 (patch)
tree4bbec9068cb7fb74a4306ed901a50f370f15fcb4 /OpenSim/Region
parentfix the comment section of max_distance setting to reflect default value (diff)
downloadopensim-SC_OLD-3552cfb1a520d75211ed88b38342d9b141c46d28.zip
opensim-SC_OLD-3552cfb1a520d75211ed88b38342d9b141c46d28.tar.gz
opensim-SC_OLD-3552cfb1a520d75211ed88b38342d9b141c46d28.tar.bz2
opensim-SC_OLD-3552cfb1a520d75211ed88b38342d9b141c46d28.tar.xz
BulletSim: fix exceptions while rebuilding linksets with mesh children.
This should get around the exception reported in Mantis 7191 and 7204 by checking for the unbuilt child and rebuilding the linkset the next tick. A warning message is output when this rebuild happens and this message is clamped to 10 times in case there is a problem with a loop.
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs33
1 files changed, 30 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 6f4f686..67cb2f6 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -305,6 +305,10 @@ public sealed class BSLinksetCompound : BSLinkset
305 // Note that this works for rebuilding just the root after a linkset is taken apart. 305 // Note that this works for rebuilding just the root after a linkset is taken apart.
306 // Called at taint time!! 306 // Called at taint time!!
307 private bool UseBulletSimRootOffsetHack = false; // Attempt to have Bullet track the coords of root compound shape 307 private bool UseBulletSimRootOffsetHack = false; // Attempt to have Bullet track the coords of root compound shape
308 // Number of times to perform rebuilds on broken linkset children. This should only happen when
309 // a linkset is initially being created and should happen only one or two times at the most.
310 // This exists to cause a looping problem to be reported while not rebuilding a linkset forever.
311 private static int LinksetRebuildFailureLoopPrevention = 10;
308 private void RecomputeLinksetCompound() 312 private void RecomputeLinksetCompound()
309 { 313 {
310 try 314 try
@@ -376,9 +380,32 @@ public sealed class BSLinksetCompound : BSLinkset
376 OMV.Quaternion offsetRot = OMV.Quaternion.Normalize(cPrim.RawOrientation) * invRootOrientation; 380 OMV.Quaternion offsetRot = OMV.Quaternion.Normalize(cPrim.RawOrientation) * invRootOrientation;
377 381
378 // Add the child shape to the compound shape being built 382 // Add the child shape to the compound shape being built
379 m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); 383 if (childShape.physShapeInfo.HasPhysicalShape)
380 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", 384 {
381 LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot); 385 m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot);
386 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}",
387 LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot);
388 }
389 else
390 {
391 // The linkset must be in an intermediate state where all the children have not yet
392 // been constructed. This sometimes happens on startup when everything is getting
393 // built and some shapes have to wait for assets to be read in.
394 // Just skip this child for the moment and cause the shape to be rebuilt next tick.
395 // One problem might be that the shape is broken somehow and it never becomes completely
396 // available. This might cause the rebuild to happen over and over.
397 if (LinksetRebuildFailureLoopPrevention-- > 0)
398 {
399 LinksetRoot.ForceBodyShapeRebuild(false);
400 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChildWithNoShape,indx={1},cShape={2},offPos={3},offRot={4}",
401 LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot);
402 // Output an annoying warning. It should only happen once but if it keeps coming out,
403 // the user knows there is something wrong and will report it.
404 m_physicsScene.Logger.WarnFormat("{0} Linkset rebuild warning. If this happens more than one or two times, please report in Mantis 7191", LogHeader);
405 m_physicsScene.Logger.WarnFormat("{0} pName={1}, childIdx={2}, shape={3}",
406 LogHeader, LinksetRoot.Name, cPrim.LinksetChildIndex, childShape);
407 }
408 }
382 409
383 // Since we are borrowing the shape of the child, disable the origional child body 410 // Since we are borrowing the shape of the child, disable the origional child body
384 if (!IsRoot(cPrim)) 411 if (!IsRoot(cPrim))