diff options
Diffstat (limited to 'OpenSim')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 33 |
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)) |