From 48f718f39fcd61501262878a8bcfbd98efed29d2 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 29 Dec 2012 21:43:43 -0800 Subject: BulletSim: first round of conversion from direct BulletSimAPI interfacing by BulletSim core to using the BulletSimAPITemplate. Physical object creation and destruction first. --- .../Physics/BulletSPlugin/BSShapeCollection.cs | 63 ++++++++++------------ 1 file changed, 28 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 0cc51b0..e7d8d14 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs @@ -174,7 +174,7 @@ public sealed class BSShapeCollection : IDisposable // Zero any reference to the shape so it is not freed when the body is deleted. BulletSimAPI.SetCollisionShape2(PhysicsScene.World.ptr, body.ptr, IntPtr.Zero); - BulletSimAPI.DestroyObject2(PhysicsScene.World.ptr, body.ptr); + PhysicsScene.PE.DestroyObject(PhysicsScene.World, body); }); } } @@ -261,7 +261,7 @@ public sealed class BSShapeCollection : IDisposable if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,ptr={1},taintTime={2}", BSScene.DetailLogZero, shape.ptr.ToString("X"), inTaintTime); if (shapeCallback != null) shapeCallback(shape); - BulletSimAPI.DeleteCollisionShape2(PhysicsScene.World.ptr, shape.ptr); + PhysicsScene.PE.DeleteCollisionShape(PhysicsScene.World, shape); } else { @@ -342,26 +342,26 @@ public sealed class BSShapeCollection : IDisposable return; } - int numChildren = BulletSimAPI.GetNumberOfCompoundChildren2(shape.ptr); + int numChildren = PhysicsScene.PE.GetNumberOfCompoundChildren(shape); if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceCompound,shape={1},children={2}", BSScene.DetailLogZero, shape, numChildren); for (int ii = numChildren - 1; ii >= 0; ii--) { - IntPtr childShape = BulletSimAPI.RemoveChildShapeFromCompoundShapeIndex2(shape.ptr, ii); + BulletShape childShape = PhysicsScene.PE.RemoveChildShapeFromCompoundShapeIndex(shape, ii); DereferenceAnonCollisionShape(childShape); } - BulletSimAPI.DeleteCollisionShape2(PhysicsScene.World.ptr, shape.ptr); + PhysicsScene.PE.DeleteCollisionShape(PhysicsScene.World, shape); } // Sometimes we have a pointer to a collision shape but don't know what type it is. // Figure out type and call the correct dereference routine. // Called at taint-time. - private void DereferenceAnonCollisionShape(IntPtr cShape) + private void DereferenceAnonCollisionShape(BulletShape shapeInfo) { MeshDesc meshDesc; HullDesc hullDesc; - BulletShape shapeInfo = new BulletShape(cShape); + IntPtr cShape = shapeInfo.ptr; if (TryGetMeshByPtr(cShape, out meshDesc)) { shapeInfo.type = BSPhysicsShapeType.SHAPE_MESH; @@ -382,7 +382,7 @@ public sealed class BSShapeCollection : IDisposable } else { - if (BulletSimAPI.IsNativeShape2(cShape)) + if (PhysicsScene.PE.IsNativeShape(shapeInfo)) { shapeInfo.isNativeShape = true; shapeInfo.type = BSPhysicsShapeType.SHAPE_BOX; // (technically, type doesn't matter) @@ -570,19 +570,15 @@ public sealed class BSShapeCollection : IDisposable if (shapeType == BSPhysicsShapeType.SHAPE_CAPSULE) { - // The proper scale has been calculated in the prim. - newShape = new BulletShape( - // Bullet's capsule total height is the passed "height + (radius * 2)" so, the base - // capsule is radius of 0.5f (1 diameter) and height of two (1.0f + 0.5f * 2)". - // This must be taken into account when computing the scaling of the capsule. - BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1f, 1f, prim.Scale) - , shapeType); + + newShape = PhysicsScene.PE.BuildCapsuleShape(PhysicsScene.World, 1f, 1f, prim.Scale); if (DDetail) DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale); } else { // Native shapes are scaled in Bullet so set the scaling to the size - newShape = new BulletShape(BulletSimAPI.BuildNativeShape2(PhysicsScene.World.ptr, nativeShapeData), shapeType); + newShape = PhysicsScene.PE.BuildNativeShape(PhysicsScene.World, nativeShapeData); + } if (!newShape.HasPhysicalShape) { @@ -629,13 +625,14 @@ public sealed class BSShapeCollection : IDisposable private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) { + BulletShape newShape = new BulletShape(); IMesh meshData = null; - IntPtr meshPtr = IntPtr.Zero; + MeshDesc meshDesc; if (Meshes.TryGetValue(newMeshKey, out meshDesc)) { // If the mesh has already been built just use it. - meshPtr = meshDesc.ptr; + newShape = new BulletShape(meshDesc.ptr, BSPhysicsShapeType.SHAPE_MESH); } else { @@ -658,11 +655,10 @@ public sealed class BSShapeCollection : IDisposable // m_log.DebugFormat("{0}: BSShapeCollection.CreatePhysicalMesh: calling CreateMesh. lid={1}, key={2}, indices={3}, vertices={4}", // LogHeader, prim.LocalID, newMeshKey, indices.Length, vertices.Count); - meshPtr = BulletSimAPI.CreateMeshShape2(PhysicsScene.World.ptr, + newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, indices.GetLength(0), indices, vertices.Count, verticesAsFloats); } } - BulletShape newShape = new BulletShape(meshPtr, BSPhysicsShapeType.SHAPE_MESH); newShape.shapeKey = newMeshKey; return newShape; @@ -700,12 +696,14 @@ public sealed class BSShapeCollection : IDisposable private BulletShape CreatePhysicalHull(string objName, System.UInt64 newHullKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) { + BulletShape newShape = new BulletShape(); IntPtr hullPtr = IntPtr.Zero; + HullDesc hullDesc; if (Hulls.TryGetValue(newHullKey, out hullDesc)) { // If the hull shape already is created, just use it. - hullPtr = hullDesc.ptr; + newShape = new BulletShape(hullDesc.ptr, BSPhysicsShapeType.SHAPE_HULL); } else { @@ -793,11 +791,10 @@ public sealed class BSShapeCollection : IDisposable } } // create the hull data structure in Bullet - hullPtr = BulletSimAPI.CreateHullShape2(PhysicsScene.World.ptr, hullCount, convHulls); + newShape = PhysicsScene.PE.CreateHullShape(PhysicsScene.World, hullCount, convHulls); } } - BulletShape newShape = new BulletShape(hullPtr, BSPhysicsShapeType.SHAPE_HULL); newShape.shapeKey = newHullKey; return newShape; @@ -819,12 +816,12 @@ public sealed class BSShapeCollection : IDisposable // Don't need to do this as the shape is freed when the new root shape is created below. // DereferenceShape(prim.PhysShape, true, shapeCallback); - BulletShape cShape = new BulletShape( - BulletSimAPI.CreateCompoundShape2(PhysicsScene.World.ptr, false), BSPhysicsShapeType.SHAPE_COMPOUND); + + BulletShape cShape = PhysicsScene.PE.CreateCompoundShape(PhysicsScene.World, false); // Create the shape for the root prim and add it to the compound shape. Cannot be a native shape. CreateGeomMeshOrHull(prim, shapeCallback); - BulletSimAPI.AddChildShapeToCompoundShape2(cShape.ptr, prim.PhysShape.ptr, OMV.Vector3.Zero, OMV.Quaternion.Identity); + PhysicsScene.PE.AddChildShapeToCompoundShape(cShape, prim.PhysShape, OMV.Vector3.Zero, OMV.Quaternion.Identity); if (DDetail) DetailLog("{0},BSShapeCollection.GetReferenceToCompoundShape,addRootPrim,compShape={1},rootShape={2}", prim.LocalID, cShape, prim.PhysShape); @@ -932,7 +929,7 @@ public sealed class BSShapeCollection : IDisposable // If not a solid object, body is a GhostObject. Otherwise a RigidBody. if (!mustRebuild) { - CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(prim.PhysBody.ptr); + CollisionObjectTypes bodyType = (CollisionObjectTypes)PhysicsScene.PE.GetBodyType(prim.PhysBody); if (prim.IsSolid && bodyType != CollisionObjectTypes.CO_RIGID_BODY || !prim.IsSolid && bodyType != CollisionObjectTypes.CO_GHOST_OBJECT) { @@ -947,20 +944,16 @@ public sealed class BSShapeCollection : IDisposable DereferenceBody(prim.PhysBody, true, bodyCallback); BulletBody aBody; - IntPtr bodyPtr = IntPtr.Zero; if (prim.IsSolid) { - bodyPtr = BulletSimAPI.CreateBodyFromShape2(sim.ptr, shape.ptr, - prim.LocalID, prim.RawPosition, prim.RawOrientation); - if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,mesh,ptr={1}", prim.LocalID, bodyPtr.ToString("X")); + aBody = PhysicsScene.PE.CreateBodyFromShape(sim, shape, prim.LocalID, prim.RawPosition, prim.RawOrientation); + if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,mesh,body={1}", prim.LocalID, aBody); } else { - bodyPtr = BulletSimAPI.CreateGhostFromShape2(sim.ptr, shape.ptr, - prim.LocalID, prim.RawPosition, prim.RawOrientation); - if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,ghost,ptr={1}", prim.LocalID, bodyPtr.ToString("X")); + aBody = PhysicsScene.PE.CreateGhostFromShape(sim, shape, prim.LocalID, prim.RawPosition, prim.RawOrientation); + if (DDetail) DetailLog("{0},BSShapeCollection.CreateBody,ghost,body={1}", prim.LocalID, aBody); } - aBody = new BulletBody(prim.LocalID, bodyPtr); ReferenceBody(aBody, true); -- cgit v1.1 From 9218748321519ed04da5cdffa1f29e69030171b5 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 30 Dec 2012 10:21:47 -0800 Subject: BulletSim: another round of conversion: dynamics world and collision object functions. --- OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index e7d8d14..6f819d8 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs @@ -143,7 +143,7 @@ public sealed class BSShapeCollection : IDisposable { if (!BulletSimAPI.IsInWorld2(body.ptr)) { - BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, body.ptr); + PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, body); if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,addedToWorld,ref={1}", body.ID, body); } }); @@ -168,12 +168,12 @@ public sealed class BSShapeCollection : IDisposable if (BulletSimAPI.IsInWorld2(body.ptr)) { - BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, body.ptr); + PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, body); if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceBody,removingFromWorld. Body={1}", body.ID, body); } // Zero any reference to the shape so it is not freed when the body is deleted. - BulletSimAPI.SetCollisionShape2(PhysicsScene.World.ptr, body.ptr, IntPtr.Zero); + PhysicsScene.PE.SetCollisionShape(PhysicsScene.World, body, new BulletShape()); PhysicsScene.PE.DestroyObject(PhysicsScene.World, body); }); } -- cgit v1.1 From 5379d6d112a8027c8f0f62ba77303e8b69e24332 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 30 Dec 2012 10:37:37 -0800 Subject: BulletSim: remove all the debug printing of pointer formatting (.ToString(X)) and replace it with a method on BulletBody, BulletShape, ... --- OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 6f819d8..d59e455 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs @@ -259,7 +259,7 @@ public sealed class BSShapeCollection : IDisposable { // Native shapes are not tracked and are released immediately if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceShape,deleteNativeShape,ptr={1},taintTime={2}", - BSScene.DetailLogZero, shape.ptr.ToString("X"), inTaintTime); + BSScene.DetailLogZero, shape.AddrString, inTaintTime); if (shapeCallback != null) shapeCallback(shape); PhysicsScene.PE.DeleteCollisionShape(PhysicsScene.World, shape); } @@ -336,9 +336,9 @@ public sealed class BSShapeCollection : IDisposable { // Failed the sanity check!! PhysicsScene.Logger.ErrorFormat("{0} Attempt to free a compound shape that is not compound!! type={1}, ptr={2}", - LogHeader, shape.type, shape.ptr.ToString("X")); + LogHeader, shape.type, shape.AddrString); if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceCompound,notACompoundShape,type={1},ptr={2}", - BSScene.DetailLogZero, shape.type, shape.ptr.ToString("X")); + BSScene.DetailLogZero, shape.type, shape.AddrString); return; } @@ -400,7 +400,7 @@ public sealed class BSShapeCollection : IDisposable else { PhysicsScene.Logger.ErrorFormat("{0} Could not decypher shape type. Region={1}, addr={2}", - LogHeader, PhysicsScene.RegionName, cShape.ToString("X")); + LogHeader, PhysicsScene.RegionName, shapeInfo.AddrString); } } -- cgit v1.1 From c2a7af18b639646b647eb4cdff4168a2b9746ee4 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 30 Dec 2012 14:26:57 -0800 Subject: BulletSim: nearly complete in conversion from BulletSimAPI to BSAPITemplate. Only initialization and debug fuctions left. --- OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index d59e455..cd77581 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs @@ -141,7 +141,7 @@ public sealed class BSShapeCollection : IDisposable if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,newBody,body={1}", body.ID, body); PhysicsScene.TaintedObject(inTaintTime, "BSShapeCollection.ReferenceBody", delegate() { - if (!BulletSimAPI.IsInWorld2(body.ptr)) + if (!PhysicsScene.PE.IsInWorld(body)) { PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, body); if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,addedToWorld,ref={1}", body.ID, body); @@ -166,7 +166,7 @@ public sealed class BSShapeCollection : IDisposable // If the caller needs to know the old body is going away, pass the event up. if (bodyCallback != null) bodyCallback(body); - if (BulletSimAPI.IsInWorld2(body.ptr)) + if (PhysicsScene.PE.IsInWorld(body)) { PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, body); if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceBody,removingFromWorld. Body={1}", body.ID, body); @@ -332,7 +332,7 @@ public sealed class BSShapeCollection : IDisposable // Called at taint-time. private void DereferenceCompound(BulletShape shape, ShapeDestructionCallback shapeCallback) { - if (!BulletSimAPI.IsCompound2(shape.ptr)) + if (!PhysicsScene.PE.IsCompound(shape)) { // Failed the sanity check!! PhysicsScene.Logger.ErrorFormat("{0} Attempt to free a compound shape that is not compound!! type={1}, ptr={2}", @@ -376,7 +376,7 @@ public sealed class BSShapeCollection : IDisposable } else { - if (BulletSimAPI.IsCompound2(cShape)) + if (PhysicsScene.PE.IsCompound(shapeInfo)) { shapeInfo.type = BSPhysicsShapeType.SHAPE_COMPOUND; } @@ -467,7 +467,7 @@ public sealed class BSShapeCollection : IDisposable // Get the scale of any existing shape so we can see if the new shape is same native type and same size. OMV.Vector3 scaleOfExistingShape = OMV.Vector3.Zero; if (prim.PhysShape.HasPhysicalShape) - scaleOfExistingShape = BulletSimAPI.GetLocalScaling2(prim.PhysShape.ptr); + scaleOfExistingShape = PhysicsScene.PE.GetLocalScaling(prim.PhysShape); if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); -- cgit v1.1 From 04132d3af4c8f44639ea842091f86274513e2dfd Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 1 Jan 2013 09:30:49 -0800 Subject: BulletSim: subclass Bullet[World|Body|Shape|Constraint] for unmanaged to have pointers and managed to have objects. Initial paste of XNA code. Commented out. --- .../Physics/BulletSPlugin/BSShapeCollection.cs | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index cd77581..2b652f5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs @@ -45,7 +45,7 @@ public sealed class BSShapeCollection : IDisposable // Description of a Mesh private struct MeshDesc { - public IntPtr ptr; + public BulletShape shape; public int referenceCount; public DateTime lastReferenced; public UInt64 shapeKey; @@ -55,7 +55,7 @@ public sealed class BSShapeCollection : IDisposable // Meshes and hulls have the same shape hash key but we only need hulls for efficient collision calculations. private struct HullDesc { - public IntPtr ptr; + public BulletShape shape; public int referenceCount; public DateTime lastReferenced; public UInt64 shapeKey; @@ -173,7 +173,7 @@ public sealed class BSShapeCollection : IDisposable } // Zero any reference to the shape so it is not freed when the body is deleted. - PhysicsScene.PE.SetCollisionShape(PhysicsScene.World, body, new BulletShape()); + PhysicsScene.PE.SetCollisionShape(PhysicsScene.World, body, null); PhysicsScene.PE.DestroyObject(PhysicsScene.World, body); }); } @@ -202,7 +202,7 @@ public sealed class BSShapeCollection : IDisposable else { // This is a new reference to a mesh - meshDesc.ptr = shape.ptr; + meshDesc.shape = shape.Clone(); meshDesc.shapeKey = shape.shapeKey; // We keep a reference to the underlying IMesh data so a hull can be built meshDesc.referenceCount = 1; @@ -225,7 +225,7 @@ public sealed class BSShapeCollection : IDisposable else { // This is a new reference to a hull - hullDesc.ptr = shape.ptr; + hullDesc.shape = shape.Clone(); hullDesc.shapeKey = shape.shapeKey; hullDesc.referenceCount = 1; if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceShape,newHull,key={1},cnt={2}", @@ -361,15 +361,14 @@ public sealed class BSShapeCollection : IDisposable MeshDesc meshDesc; HullDesc hullDesc; - IntPtr cShape = shapeInfo.ptr; - if (TryGetMeshByPtr(cShape, out meshDesc)) + if (TryGetMeshByPtr(shapeInfo, out meshDesc)) { shapeInfo.type = BSPhysicsShapeType.SHAPE_MESH; shapeInfo.shapeKey = meshDesc.shapeKey; } else { - if (TryGetHullByPtr(cShape, out hullDesc)) + if (TryGetHullByPtr(shapeInfo, out hullDesc)) { shapeInfo.type = BSPhysicsShapeType.SHAPE_HULL; shapeInfo.shapeKey = hullDesc.shapeKey; @@ -632,7 +631,7 @@ public sealed class BSShapeCollection : IDisposable if (Meshes.TryGetValue(newMeshKey, out meshDesc)) { // If the mesh has already been built just use it. - newShape = new BulletShape(meshDesc.ptr, BSPhysicsShapeType.SHAPE_MESH); + newShape = meshDesc.shape.Clone(); } else { @@ -703,7 +702,7 @@ public sealed class BSShapeCollection : IDisposable if (Hulls.TryGetValue(newHullKey, out hullDesc)) { // If the hull shape already is created, just use it. - newShape = new BulletShape(hullDesc.ptr, BSPhysicsShapeType.SHAPE_HULL); + newShape = hullDesc.shape.Clone(); } else { @@ -965,13 +964,13 @@ public sealed class BSShapeCollection : IDisposable return ret; } - private bool TryGetMeshByPtr(IntPtr addr, out MeshDesc outDesc) + private bool TryGetMeshByPtr(BulletShape shape, out MeshDesc outDesc) { bool ret = false; MeshDesc foundDesc = new MeshDesc(); foreach (MeshDesc md in Meshes.Values) { - if (md.ptr == addr) + if (md.shape.ReferenceSame(shape)) { foundDesc = md; ret = true; @@ -983,13 +982,13 @@ public sealed class BSShapeCollection : IDisposable return ret; } - private bool TryGetHullByPtr(IntPtr addr, out HullDesc outDesc) + private bool TryGetHullByPtr(BulletShape shape, out HullDesc outDesc) { bool ret = false; HullDesc foundDesc = new HullDesc(); foreach (HullDesc hd in Hulls.Values) { - if (hd.ptr == addr) + if (hd.shape.ReferenceSame(shape)) { foundDesc = hd; ret = true; -- cgit v1.1 From 9d840fd2ee5c3e6c6f788e8145f06701e9ea2724 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 1 Jan 2013 16:49:38 -0800 Subject: BulletSim: move over and port the interface for BulletXNA. Copied BulletSNPlugin.BulletSimAPI to a new BulletSPlugin.BSAPIXNA.cs and then modifyed the latter to comply with the BSAPITemplate definition. Not totally debugged but the code is all there for an INI variable to select either unmanaged C++ Bullet or the C# version of Bullet. --- OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 2b652f5..d361f18 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs @@ -141,7 +141,7 @@ public sealed class BSShapeCollection : IDisposable if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,newBody,body={1}", body.ID, body); PhysicsScene.TaintedObject(inTaintTime, "BSShapeCollection.ReferenceBody", delegate() { - if (!PhysicsScene.PE.IsInWorld(body)) + if (!PhysicsScene.PE.IsInWorld(PhysicsScene.World, body)) { PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, body); if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,addedToWorld,ref={1}", body.ID, body); @@ -166,7 +166,7 @@ public sealed class BSShapeCollection : IDisposable // If the caller needs to know the old body is going away, pass the event up. if (bodyCallback != null) bodyCallback(body); - if (PhysicsScene.PE.IsInWorld(body)) + if (PhysicsScene.PE.IsInWorld(PhysicsScene.World, body)) { PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, body); if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceBody,removingFromWorld. Body={1}", body.ID, body); -- cgit v1.1