aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs47
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs16
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs70
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs7
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs91
5 files changed, 192 insertions, 39 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 4f10d46..4d17e6c 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -474,12 +474,13 @@ public sealed class BSPrim : BSPhysObject
474 */ 474 */
475 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.Ptr, BSBody.Ptr); 475 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.Ptr, BSBody.Ptr);
476 476
477 // Set up the object physicalness (does gravity and collisions move this object)
478 MakeDynamic(IsStatic);
479
480 // Make solid or not (do things bounce off or pass through this object) 477 // Make solid or not (do things bounce off or pass through this object)
478 // This is done first because it can change the collisionObject type.
481 MakeSolid(IsSolid); 479 MakeSolid(IsSolid);
482 480
481 // Set up the object physicalness (does gravity and collisions move this object)
482 MakeDynamic(IsStatic);
483
483 // Arrange for collisions events if the simulator wants them 484 // Arrange for collisions events if the simulator wants them
484 EnableCollisions(SubscribedEvents()); 485 EnableCollisions(SubscribedEvents());
485 486
@@ -554,17 +555,51 @@ public sealed class BSPrim : BSPhysObject
554 } 555 }
555 556
556 // "Making solid" means that other object will not pass through this object. 557 // "Making solid" means that other object will not pass through this object.
558 // To make transparent, we create a Bullet ghost object.
559 // Note: This expects to be called from the UpdatePhysicalParameters() routine as
560 // the functions after this one set up the state of a possibly newly created collision body.
557 private void MakeSolid(bool makeSolid) 561 private void MakeSolid(bool makeSolid)
558 { 562 {
563 CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(BSBody.Ptr);
564 /*
559 if (makeSolid) 565 if (makeSolid)
560 { 566 {
561 // Easy in Bullet -- just remove the object flag that controls collision response 567 if ((bodyType & CollisionObjectTypes.CO_RIGID_BODY) == 0)
562 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.Ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 568 {
569 // Solid things are made out of rigid bodies. Remove this old body from the world
570 // and use this shape in a new rigid body.
571 BulletBody oldBody = BSBody;
572 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.Ptr, BSBody.Ptr);
573 BSShape = new BulletShape(BulletSimAPI.GetCollisionShape2(BSBody.Ptr));
574 BSBody = new BulletBody(LocalID, BulletSimAPI.CreateBodyFromShape2(PhysicsScene.World.Ptr, BSShape.Ptr, _position, _orientation));
575 BulletSimAPI.DestroyObject2(PhysicsScene.World.Ptr, oldBody.Ptr);
576 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.Ptr, BSBody.Ptr);
577 }
563 } 578 }
564 else 579 else
565 { 580 {
566 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.Ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 581 if ((bodyType & CollisionObjectTypes.CO_GHOST_OBJECT) == 0)
582 {
583 // Non-solid things are made out of ghost objects. Remove this old body from the world
584 // and use this shape in a new rigid body.
585 BulletBody oldBody = BSBody;
586 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.Ptr, BSBody.Ptr);
587 BSShape = new BulletShape(BulletSimAPI.GetCollisionShape2(BSBody.Ptr));
588 BSBody = new BulletBody(LocalID,
589 BulletSimAPI.CreateGhostFromShape2(PhysicsScene.World.Ptr, BSShape.Ptr, _position, _orientation));
590 if (BSBody.Ptr == IntPtr.Zero)
591 {
592 m_log.ErrorFormat("{0} BSPrim.MakeSolid: failed creation of ghost object. LocalID=[1}", LogHeader, LocalID);
593 BSBody = oldBody;
594 }
595 else
596 {
597 BulletSimAPI.DestroyObject2(PhysicsScene.World.Ptr, oldBody.Ptr);
598 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.Ptr, BSBody.Ptr);
599 }
600 }
567 } 601 }
602 */
568 } 603 }
569 604
570 // Turn on or off the flag controlling whether collision events are returned to the simulator. 605 // Turn on or off the flag controlling whether collision events are returned to the simulator.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index dabced5..76da42d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -73,8 +73,10 @@ public class BSScene : PhysicsScene, IPhysicsParameters
73 73
74 public string BulletSimVersion = "?"; 74 public string BulletSimVersion = "?";
75 75
76 public Dictionary<uint, BSPhysObject> PhysObjects = new Dictionary<uint, BSPhysObject>(); 76 public Dictionary<uint, BSPhysObject> PhysObjects;
77 public BSShapeCollection Shapes;
77 78
79 // Keeping track of the objects with collisions so we can report begin and end of a collision
78 public HashSet<BSPhysObject> ObjectsWithCollisions = new HashSet<BSPhysObject>(); 80 public HashSet<BSPhysObject> ObjectsWithCollisions = new HashSet<BSPhysObject>();
79 public HashSet<BSPhysObject> ObjectsWithNoMoreCollisions = new HashSet<BSPhysObject>(); 81 public HashSet<BSPhysObject> ObjectsWithNoMoreCollisions = new HashSet<BSPhysObject>();
80 // Keep track of all the avatars so we can send them a collision event 82 // Keep track of all the avatars so we can send them a collision event
@@ -203,6 +205,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters
203 205
204 public override void Initialise(IMesher meshmerizer, IConfigSource config) 206 public override void Initialise(IMesher meshmerizer, IConfigSource config)
205 { 207 {
208 mesher = meshmerizer;
209 _taintedObjects = new List<TaintCallbackEntry>();
210 PhysObjects = new Dictionary<uint, BSPhysObject>();
211 Shapes = new BSShapeCollection(this);
212
206 // Allocate pinned memory to pass parameters. 213 // Allocate pinned memory to pass parameters.
207 m_params = new ConfigurationParameters[1]; 214 m_params = new ConfigurationParameters[1];
208 m_paramsHandle = GCHandle.Alloc(m_params, GCHandleType.Pinned); 215 m_paramsHandle = GCHandle.Alloc(m_params, GCHandleType.Pinned);
@@ -216,12 +223,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
216 m_updateArray = new EntityProperties[m_maxUpdatesPerFrame]; 223 m_updateArray = new EntityProperties[m_maxUpdatesPerFrame];
217 m_updateArrayPinnedHandle = GCHandle.Alloc(m_updateArray, GCHandleType.Pinned); 224 m_updateArrayPinnedHandle = GCHandle.Alloc(m_updateArray, GCHandleType.Pinned);
218 225
219 mesher = meshmerizer;
220 _taintedObjects = new List<TaintCallbackEntry>();
221
222 // Enable very detailed logging. 226 // Enable very detailed logging.
223 // By creating an empty logger when not logging, the log message invocation code 227 // By creating an empty logger when not logging, the log message invocation code
224 // can be left in and every call doesn't have to check for null. 228 // can be left in and every call doesn't have to check for null.
225 if (m_physicsLoggingEnabled) 229 if (m_physicsLoggingEnabled)
226 { 230 {
227 PhysicsLogging = new Logging.LogWriter(m_physicsLoggingDir, m_physicsLoggingPrefix, m_physicsLoggingFileMinutes); 231 PhysicsLogging = new Logging.LogWriter(m_physicsLoggingDir, m_physicsLoggingPrefix, m_physicsLoggingFileMinutes);
@@ -252,7 +256,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
252 // a child in a mega-region. 256 // a child in a mega-region.
253 // Turns out that Bullet really doesn't care about the extents of the simulated 257 // Turns out that Bullet really doesn't care about the extents of the simulated
254 // area. It tracks active objects no matter where they are. 258 // area. It tracks active objects no matter where they are.
255 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 8192f); 259 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
256 260
257 // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader); 261 // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader);
258 WorldID = BulletSimAPI.Initialize(worldExtent, m_paramsHandle.AddrOfPinnedObject(), 262 WorldID = BulletSimAPI.Initialize(worldExtent, m_paramsHandle.AddrOfPinnedObject(),
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
new file mode 100755
index 0000000..eb4b2ad
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -0,0 +1,70 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Text;
30using OMV = OpenMetaverse;
31
32namespace OpenSim.Region.Physics.BulletSPlugin
33{
34public class BSShapeCollection : IDisposable
35{
36 protected BSScene PhysicsScene { get; set; }
37
38 public BSShapeCollection(BSScene physScene)
39 {
40 PhysicsScene = physScene;
41 }
42
43 public void Dispose()
44 {
45 }
46
47 // Track another user of a body
48 public void ReferenceBody(BulletBody shape)
49 {
50 }
51
52 // Release the usage of a body
53 public void DereferenceBody(BulletBody shape)
54 {
55 }
56
57 // Track another user of the shape
58 public void ReferenceShape(BulletShape shape)
59 {
60 }
61
62 // Release the usage of a shape
63 public void DereferenceShape(BulletShape shape)
64 {
65 }
66
67
68
69}
70}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index c113db1..fb802e4 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -107,7 +107,9 @@ public class BSTerrainManager
107 public void CreateInitialGroundPlaneAndTerrain() 107 public void CreateInitialGroundPlaneAndTerrain()
108 { 108 {
109 // The ground plane is here to catch things that are trying to drop to negative infinity 109 // The ground plane is here to catch things that are trying to drop to negative infinity
110 BulletShape groundPlaneShape = new BulletShape(BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN)); 110 BulletShape groundPlaneShape = new BulletShape(
111 BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN),
112 ShapeData.PhysicsShapeType.SHAPE_GROUNDPLANE);
111 m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, 113 m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID,
112 BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.Ptr, Vector3.Zero, Quaternion.Identity)); 114 BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.Ptr, Vector3.Zero, Quaternion.Identity));
113 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.Ptr, m_groundPlane.Ptr); 115 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.Ptr, m_groundPlane.Ptr);
@@ -297,7 +299,8 @@ public class BSTerrainManager
297 centerPos.Z = minZ + ((maxZ - minZ) / 2f); 299 centerPos.Z = minZ + ((maxZ - minZ) / 2f);
298 300
299 // Create the terrain shape from the mapInfo 301 // Create the terrain shape from the mapInfo
300 mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(mapInfo.Ptr)); 302 mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(mapInfo.Ptr),
303 ShapeData.PhysicsShapeType.SHAPE_TERRAIN);
301 304
302 mapInfo.terrainBody = new BulletBody(mapInfo.ID, 305 mapInfo.terrainBody = new BulletBody(mapInfo.ID,
303 BulletSimAPI.CreateBodyWithDefaultMotionState2(mapInfo.terrainShape.Ptr, 306 BulletSimAPI.CreateBodyWithDefaultMotionState2(mapInfo.terrainShape.Ptr,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index 4d2d962..52c8a24 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -38,31 +38,54 @@ namespace OpenSim.Region.Physics.BulletSPlugin {
38// The physics engine controller class created at initialization 38// The physics engine controller class created at initialization
39public struct BulletSim 39public struct BulletSim
40{ 40{
41 public BulletSim(uint worldId, BSScene bss, IntPtr xx) { worldID = worldId; scene = bss; Ptr = xx; } 41 public BulletSim(uint worldId, BSScene bss, IntPtr xx)
42 {
43 worldID = worldId; scene = bss; Ptr = xx;
44 }
42 public uint worldID; 45 public uint worldID;
43 // The scene is only in here so very low level routines have a handle to print debug/error messages 46 // The scene is only in here so very low level routines have a handle to print debug/error messages
44 public BSScene scene; 47 public BSScene scene;
45 public IntPtr Ptr; 48 public IntPtr Ptr;
46} 49}
47 50
48public struct BulletShape 51// An allocated Bullet btRigidBody
52public struct BulletBody
49{ 53{
50 public BulletShape(IntPtr xx) { Ptr = xx; } 54 public BulletBody(uint id, IntPtr xx)
55 {
56 ID = id;
57 Ptr = xx;
58 }
51 public IntPtr Ptr; 59 public IntPtr Ptr;
60 public uint ID;
52} 61}
53 62
54// An allocated Bullet btRigidBody 63public struct BulletShape
55public struct BulletBody
56{ 64{
57 public BulletBody(uint id, IntPtr xx) { ID = id; Ptr = xx; } 65 public BulletShape(IntPtr xx)
66 {
67 Ptr = xx;
68 type=ShapeData.PhysicsShapeType.SHAPE_UNKNOWN;
69 hashKey = 0;
70 }
71 public BulletShape(IntPtr xx, ShapeData.PhysicsShapeType typ)
72 {
73 Ptr = xx;
74 type = typ;
75 hashKey = 0;
76 }
58 public IntPtr Ptr; 77 public IntPtr Ptr;
59 public uint ID; 78 public ShapeData.PhysicsShapeType type;
79 public ulong hashKey;
60} 80}
61 81
62// An allocated Bullet btConstraint 82// An allocated Bullet btConstraint
63public struct BulletConstraint 83public struct BulletConstraint
64{ 84{
65 public BulletConstraint(IntPtr xx) { Ptr = xx; } 85 public BulletConstraint(IntPtr xx)
86 {
87 Ptr = xx;
88 }
66 public IntPtr Ptr; 89 public IntPtr Ptr;
67} 90}
68 91
@@ -96,14 +119,14 @@ public class BulletHeightMapInfo
96 119
97// =============================================================================== 120// ===============================================================================
98[StructLayout(LayoutKind.Sequential)] 121[StructLayout(LayoutKind.Sequential)]
99public struct ConvexHull 122public struct ConvexHull
100{ 123{
101 Vector3 Offset; 124 Vector3 Offset;
102 int VertexCount; 125 int VertexCount;
103 Vector3[] Vertices; 126 Vector3[] Vertices;
104} 127}
105[StructLayout(LayoutKind.Sequential)] 128[StructLayout(LayoutKind.Sequential)]
106public struct ShapeData 129public struct ShapeData
107{ 130{
108 public enum PhysicsShapeType 131 public enum PhysicsShapeType
109 { 132 {
@@ -114,7 +137,9 @@ public struct ShapeData
114 SHAPE_CYLINDER = 4, 137 SHAPE_CYLINDER = 4,
115 SHAPE_SPHERE = 5, 138 SHAPE_SPHERE = 5,
116 SHAPE_MESH = 6, 139 SHAPE_MESH = 6,
117 SHAPE_HULL = 7 140 SHAPE_HULL = 7,
141 SHAPE_GROUNDPLANE = 8,
142 SHAPE_TERRAIN = 9,
118 }; 143 };
119 public uint ID; 144 public uint ID;
120 public PhysicsShapeType Type; 145 public PhysicsShapeType Type;
@@ -136,7 +161,7 @@ public struct ShapeData
136 public const float numericFalse = 0f; 161 public const float numericFalse = 0f;
137} 162}
138[StructLayout(LayoutKind.Sequential)] 163[StructLayout(LayoutKind.Sequential)]
139public struct SweepHit 164public struct SweepHit
140{ 165{
141 public uint ID; 166 public uint ID;
142 public float Fraction; 167 public float Fraction;
@@ -227,7 +252,17 @@ public enum ActivationState : uint
227 ISLAND_SLEEPING, 252 ISLAND_SLEEPING,
228 WANTS_DEACTIVATION, 253 WANTS_DEACTIVATION,
229 DISABLE_DEACTIVATION, 254 DISABLE_DEACTIVATION,
230 DISABLE_SIMULATION 255 DISABLE_SIMULATION,
256}
257
258public enum CollisionObjectTypes : int
259{
260 CO_COLLISION_OBJECT = 1 << 0,
261 CO_RIGID_BODY = 1 << 1,
262 CO_GHOST_OBJECT = 1 << 2,
263 CO_SOFT_BODY = 1 << 3,
264 CO_HF_FLUID = 1 << 4,
265 CO_USER_TYPE = 1 << 5,
231} 266}
232 267
233// Values used by Bullet and BulletSim to control object properties. 268// Values used by Bullet and BulletSim to control object properties.
@@ -313,8 +348,8 @@ public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg
313public static extern string GetVersion(); 348public static extern string GetVersion();
314 349
315[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 350[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
316public static extern uint Initialize(Vector3 maxPosition, IntPtr parms, 351public static extern uint Initialize(Vector3 maxPosition, IntPtr parms,
317 int maxCollisions, IntPtr collisionArray, 352 int maxCollisions, IntPtr collisionArray,
318 int maxUpdates, IntPtr updateArray, 353 int maxUpdates, IntPtr updateArray,
319 DebugLogCallback logRoutine); 354 DebugLogCallback logRoutine);
320 355
@@ -333,19 +368,19 @@ public static extern bool UpdateParameter(uint worldID, uint localID,
333 368
334// =============================================================================== 369// ===============================================================================
335[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 370[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
336public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep, 371public static extern int PhysicsStep(uint worldID, float timeStep, int maxSubSteps, float fixedTimeStep,
337 out int updatedEntityCount, 372 out int updatedEntityCount,
338 out IntPtr updatedEntitiesPtr, 373 out IntPtr updatedEntitiesPtr,
339 out int collidersCount, 374 out int collidersCount,
340 out IntPtr collidersPtr); 375 out IntPtr collidersPtr);
341 376
342[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 377[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
343public static extern bool CreateHull(uint worldID, System.UInt64 meshKey, 378public static extern bool CreateHull(uint worldID, System.UInt64 meshKey,
344 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls 379 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls
345 ); 380 );
346 381
347[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 382[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
348public static extern bool CreateMesh(uint worldID, System.UInt64 meshKey, 383public static extern bool CreateMesh(uint worldID, System.UInt64 meshKey,
349 int indexCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, 384 int indexCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
350 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices 385 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices
351 ); 386 );
@@ -459,7 +494,7 @@ public static extern void Shutdown2(IntPtr sim);
459 494
460[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 495[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
461public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, 496public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep,
462 out int updatedEntityCount, 497 out int updatedEntityCount,
463 out IntPtr updatedEntitiesPtr, 498 out IntPtr updatedEntitiesPtr,
464 out int collidersCount, 499 out int collidersCount,
465 out IntPtr collidersPtr); 500 out IntPtr collidersPtr);
@@ -470,8 +505,8 @@ public static extern bool PushUpdate2(IntPtr obj);
470// ===================================================================================== 505// =====================================================================================
471// Mesh, hull, shape and body creation helper routines 506// Mesh, hull, shape and body creation helper routines
472[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 507[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
473public static extern IntPtr CreateMeshShape2(IntPtr world, 508public static extern IntPtr CreateMeshShape2(IntPtr world,
474 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, 509 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
475 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); 510 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices );
476 511
477[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 512[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
@@ -504,12 +539,18 @@ public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape
504public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape); 539public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape);
505 540
506[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 541[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
542public static extern int GetBodyType2(IntPtr obj);
543
544[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
507public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, Vector3 pos, Quaternion rot); 545public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, Vector3 pos, Quaternion rot);
508 546
509[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 547[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
510public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, Vector3 pos, Quaternion rot); 548public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, Vector3 pos, Quaternion rot);
511 549
512[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 550[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
551public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, Vector3 pos, Quaternion rot);
552
553[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
513public static extern IntPtr AllocateBodyInfo2(IntPtr obj); 554public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
514 555
515[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 556[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
@@ -521,11 +562,11 @@ public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
521// ===================================================================================== 562// =====================================================================================
522// Terrain creation and helper routines 563// Terrain creation and helper routines
523[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 564[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
524public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, 565public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
525 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 566 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
526 567
527[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 568[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
528public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, 569public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
529 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 570 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
530 571
531[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 572[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
@@ -563,7 +604,7 @@ public static extern void SetConstraintEnable2(IntPtr constrain, float numericTr
563public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); 604public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations);
564 605
565[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 606[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
566public static extern bool SetFrames2(IntPtr constrain, 607public static extern bool SetFrames2(IntPtr constrain,
567 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); 608 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
568 609
569[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 610[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]