aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs31
1 files changed, 26 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 89d0d3e..b1833c5 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
36{ 36{
37public class BSShapeCollection : IDisposable 37public class BSShapeCollection : IDisposable
38{ 38{
39 // private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]"; 39 private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]";
40 40
41 protected BSScene PhysicsScene { get; set; } 41 protected BSScene PhysicsScene { get; set; }
42 42
@@ -434,16 +434,26 @@ public class BSShapeCollection : IDisposable
434 ShapeData shapeData, ShapeData.FixedShapeKey shapeKey) 434 ShapeData shapeData, ShapeData.FixedShapeKey shapeKey)
435 { 435 {
436 BulletShape newShape; 436 BulletShape newShape;
437 // Need to make sure the passed shape information is for the native type.
438 ShapeData nativeShapeData = shapeData;
439 nativeShapeData.Type = shapeType;
440 nativeShapeData.MeshKey = (ulong)shapeKey;
441 nativeShapeData.HullKey = (ulong)shapeKey;
437 442
438 if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR) 443 if (shapeType == ShapeData.PhysicsShapeType.SHAPE_AVATAR)
439 { 444 {
440 newShape = new BulletShape( 445 newShape = new BulletShape(
441 BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1.0f, 1.0f, shapeData.Scale), 446 BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1.0f, 1.0f, nativeShapeData.Scale), shapeType);
442 shapeType); 447 DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", nativeShapeData.ID, nativeShapeData.Scale);
443 } 448 }
444 else 449 else
445 { 450 {
446 newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, shapeData), shapeType); 451 newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, nativeShapeData), shapeType);
452 }
453 if (newShape.ptr == IntPtr.Zero)
454 {
455 PhysicsScene.Logger.ErrorFormat("{0} BuildPhysicalNativeShape failed. ID={1}, shape={2}",
456 LogHeader, nativeShapeData.ID, nativeShapeData.Type);
447 } 457 }
448 newShape.shapeKey = (System.UInt64)shapeKey; 458 newShape.shapeKey = (System.UInt64)shapeKey;
449 newShape.isNativeShape = true; 459 newShape.isNativeShape = true;
@@ -716,6 +726,8 @@ public class BSShapeCollection : IDisposable
716 { 726 {
717 prim.LastAssetBuildFailed = true; 727 prim.LastAssetBuildFailed = true;
718 BSPhysObject xprim = prim; 728 BSPhysObject xprim = prim;
729 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lID={1},lastFailed={2}",
730 LogHeader, shapeData.ID.ToString("X"), prim.LastAssetBuildFailed);
719 Util.FireAndForget(delegate 731 Util.FireAndForget(delegate
720 { 732 {
721 RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod; 733 RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod;
@@ -732,16 +744,25 @@ public class BSShapeCollection : IDisposable
732 yprim.BaseShape.SculptData = asset.Data; 744 yprim.BaseShape.SculptData = asset.Data;
733 // This will cause the prim to see that the filler shape is not the right 745 // This will cause the prim to see that the filler shape is not the right
734 // one and try again to build the object. 746 // one and try again to build the object.
747 // No race condition with the native sphere setting since the rebuild is at taint time.
735 yprim.ForceBodyShapeRebuild(false); 748 yprim.ForceBodyShapeRebuild(false);
736 749
737 }); 750 });
738 } 751 }
739 }); 752 });
740 } 753 }
754 else
755 {
756 if (prim.LastAssetBuildFailed)
757 {
758 PhysicsScene.Logger.ErrorFormat("{0} Mesh failed to fetch asset. lID={1}, texture={2}",
759 LogHeader, shapeData.ID, pbs.SculptTexture);
760 }
761 }
741 762
742 // While we figure out the real problem, stick a simple native shape on the object. 763 // While we figure out the real problem, stick a simple native shape on the object.
743 BulletShape fillinShape = 764 BulletShape fillinShape =
744 BuildPhysicalNativeShape(ShapeData.PhysicsShapeType.SHAPE_SPHERE, shapeData, ShapeData.FixedShapeKey.KEY_SPHERE); 765 BuildPhysicalNativeShape(ShapeData.PhysicsShapeType.SHAPE_BOX, shapeData, ShapeData.FixedShapeKey.KEY_BOX);
745 766
746 return fillinShape; 767 return fillinShape;
747 } 768 }