aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs2425
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs46
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs17
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs30
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs10
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs10
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs12
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs8
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs74
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs6
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs23
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs13
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs16
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs8
15 files changed, 1454 insertions, 1248 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
index bbfc1f8..9a8a2e8 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
@@ -1,1107 +1,1318 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD 9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the 12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27using System; 27using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30using System.Security; 30using System.Security;
31using System.Text; 31using System.Text;
32 32
33using OpenMetaverse; 33using OpenMetaverse;
34 34
35namespace OpenSim.Region.Physics.BulletSPlugin 35namespace OpenSim.Region.Physics.BulletSPlugin
36{ 36{
37public sealed class BSAPIUnman : BulletSimAPITemplate 37public sealed class BSAPIUnman : BulletSimAPITemplate
38{ 38{
39 /* 39 /*
40// Initialization and simulation 40// Initialization and simulation
41public BulletWorld Initialize(Vector3 maxPosition, IntPtr parms, 41public BulletWorld Initialize(Vector3 maxPosition, IntPtr parms,
42 int maxCollisions, IntPtr collisionArray, 42 int maxCollisions, IntPtr collisionArray,
43 int maxUpdates, IntPtr updateArray 43 int maxUpdates, IntPtr updateArray
44 ); 44 );
45 45
46public bool UpdateParameter(BulletWorld world, uint localID, String parm, float value); 46public bool UpdateParameter(BulletWorld world, uint localID, String parm, float value);
47 47
48public void SetHeightMap(BulletWorld world, float[] heightmap); 48public void SetHeightMap(BulletWorld world, float[] heightmap);
49 49
50public void Shutdown(BulletWorld sim); 50public void Shutdown(BulletWorld sim);
51 51
52public int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep, 52public int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
53 out int updatedEntityCount, 53 out int updatedEntityCount,
54 out IntPtr updatedEntitiesPtr, 54 out IntPtr updatedEntitiesPtr,
55 out int collidersCount, 55 out int collidersCount,
56 out IntPtr collidersPtr); 56 out IntPtr collidersPtr);
57 57
58public bool PushUpdate(BulletBody obj); 58public bool PushUpdate(BulletBody obj);
59 */ 59 */
60 60
61// ===================================================================================== 61// =====================================================================================
62// Mesh, hull, shape and body creation helper routines 62// Mesh, hull, shape and body creation helper routines
63public override BulletShape CreateMeshShape(BulletWorld world, 63public override BulletShape CreateMeshShape(BulletWorld world,
64 int indicesCount, int[] indices, 64 int indicesCount, int[] indices,
65 int verticesCount, float[] vertices) 65 int verticesCount, float[] vertices)
66{ 66{
67 return new BulletShape( 67 return new BulletShape(
68 BSAPI.CreateMeshShape2(world.ptr, indicesCount, indices, verticesCount, vertices), 68 BSAPICPP.CreateMeshShape2(world.ptr, indicesCount, indices, verticesCount, vertices),
69 BSPhysicsShapeType.SHAPE_MESH); 69 BSPhysicsShapeType.SHAPE_MESH);
70} 70}
71 71
72public override BulletShape CreateHullShape(BulletWorld world, int hullCount, float[] hulls) 72public override BulletShape CreateHullShape(BulletWorld world, int hullCount, float[] hulls)
73{ 73{
74 return new BulletShape( 74 return new BulletShape(
75 BSAPI.CreateHullShape2(world.ptr, hullCount, hulls), 75 BSAPICPP.CreateHullShape2(world.ptr, hullCount, hulls),
76 BSPhysicsShapeType.SHAPE_HULL); 76 BSPhysicsShapeType.SHAPE_HULL);
77} 77}
78 78
79public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape) 79public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape)
80{ 80{
81 return new BulletShape( 81 return new BulletShape(
82 BSAPI.BuildHullShapeFromMesh2(world.ptr, meshShape.ptr), 82 BSAPICPP.BuildHullShapeFromMesh2(world.ptr, meshShape.ptr),
83 BSPhysicsShapeType.SHAPE_HULL); 83 BSPhysicsShapeType.SHAPE_HULL);
84} 84}
85 85
86public override BulletShape BuildNativeShape( BulletWorld world, ShapeData shapeData) 86public override BulletShape BuildNativeShape( BulletWorld world, ShapeData shapeData)
87{ 87{
88 return new BulletShape( 88 return new BulletShape(
89 BSAPI.BuildNativeShape2(world.ptr, shapeData), 89 BSAPICPP.BuildNativeShape2(world.ptr, shapeData),
90 shapeData.Type); 90 shapeData.Type);
91} 91}
92 92
93public override bool IsNativeShape(BulletShape shape) 93public override bool IsNativeShape(BulletShape shape)
94{ 94{
95 if (shape.HasPhysicalShape) 95 if (shape.HasPhysicalShape)
96 return BSAPI.IsNativeShape2(shape.ptr); 96 return BSAPICPP.IsNativeShape2(shape.ptr);
97 return false; 97 return false;
98} 98}
99 99
100public override void SetShapeCollisionMargin(BulletShape shape, float margin) 100public override void SetShapeCollisionMargin(BulletShape shape, float margin)
101{ 101{
102 if (shape.HasPhysicalShape) 102 if (shape.HasPhysicalShape)
103 BSAPI.SetShapeCollisionMargin2(shape.ptr, margin); 103 BSAPICPP.SetShapeCollisionMargin2(shape.ptr, margin);
104} 104}
105 105
106public override BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale) 106public override BulletShape BuildCapsuleShape(BulletWorld world, float radius, float height, Vector3 scale)
107{ 107{
108 return new BulletShape( 108 return new BulletShape(
109 BSAPI.BuildCapsuleShape2(world.ptr, radius, height, scale), 109 BSAPICPP.BuildCapsuleShape2(world.ptr, radius, height, scale),
110 BSPhysicsShapeType.SHAPE_CAPSULE); 110 BSPhysicsShapeType.SHAPE_CAPSULE);
111} 111}
112 112
113public override BulletShape CreateCompoundShape(BulletWorld sim, bool enableDynamicAabbTree) 113public override BulletShape CreateCompoundShape(BulletWorld sim, bool enableDynamicAabbTree)
114{ 114{
115 return new BulletShape( 115 return new BulletShape(
116 BSAPI.CreateCompoundShape2(sim.ptr, enableDynamicAabbTree), 116 BSAPICPP.CreateCompoundShape2(sim.ptr, enableDynamicAabbTree),
117 BSPhysicsShapeType.SHAPE_COMPOUND); 117 BSPhysicsShapeType.SHAPE_COMPOUND);
118 118
119} 119}
120 120
121public override int GetNumberOfCompoundChildren(BulletShape shape) 121public override int GetNumberOfCompoundChildren(BulletShape shape)
122{ 122{
123 if (shape.HasPhysicalShape) 123 if (shape.HasPhysicalShape)
124 return BSAPI.GetNumberOfCompoundChildren2(shape.ptr); 124 return BSAPICPP.GetNumberOfCompoundChildren2(shape.ptr);
125 return 0; 125 return 0;
126} 126}
127 127
128public override void AddChildShapeToCompoundShape(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot) 128public override void AddChildShapeToCompoundShape(BulletShape cShape, BulletShape addShape, Vector3 pos, Quaternion rot)
129{ 129{
130 BSAPI.AddChildShapeToCompoundShape2(cShape.ptr, addShape.ptr, pos, rot); 130 BSAPICPP.AddChildShapeToCompoundShape2(cShape.ptr, addShape.ptr, pos, rot);
131} 131}
132 132
133public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx) 133public override BulletShape GetChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx)
134{ 134{
135 return new BulletShape(BSAPI.GetChildShapeFromCompoundShapeIndex2(cShape.ptr, indx)); 135 return new BulletShape(BSAPICPP.GetChildShapeFromCompoundShapeIndex2(cShape.ptr, indx));
136} 136}
137 137
138public override BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx) 138public override BulletShape RemoveChildShapeFromCompoundShapeIndex(BulletShape cShape, int indx)
139{ 139{
140 return new BulletShape(BSAPI.RemoveChildShapeFromCompoundShapeIndex2(cShape.ptr, indx)); 140 return new BulletShape(BSAPICPP.RemoveChildShapeFromCompoundShapeIndex2(cShape.ptr, indx));
141} 141}
142 142
143public override void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape) 143public override void RemoveChildShapeFromCompoundShape(BulletShape cShape, BulletShape removeShape)
144{ 144{
145 BSAPI.RemoveChildShapeFromCompoundShape2(cShape.ptr, removeShape.ptr); 145 BSAPICPP.RemoveChildShapeFromCompoundShape2(cShape.ptr, removeShape.ptr);
146} 146}
147 147
148public override void RecalculateCompoundShapeLocalAabb(BulletShape cShape) 148public override void RecalculateCompoundShapeLocalAabb(BulletShape cShape)
149{ 149{
150 BSAPI.RecalculateCompoundShapeLocalAabb2(cShape.ptr); 150 BSAPICPP.RecalculateCompoundShapeLocalAabb2(cShape.ptr);
151} 151}
152 152
153public override BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id) 153public override BulletShape DuplicateCollisionShape(BulletWorld sim, BulletShape srcShape, uint id)
154{ 154{
155 return new BulletShape(BSAPI.DuplicateCollisionShape2(sim.ptr, srcShape.ptr, id), srcShape.type); 155 return new BulletShape(BSAPICPP.DuplicateCollisionShape2(sim.ptr, srcShape.ptr, id), srcShape.type);
156} 156}
157 157
158public override BulletBody CreateBodyFromShapeAndInfo(BulletWorld sim, BulletShape shape, uint id, IntPtr constructionInfo) 158public override BulletBody CreateBodyFromShapeAndInfo(BulletWorld sim, BulletShape shape, uint id, IntPtr constructionInfo)
159{ 159{
160 return new BulletBody(id, BSAPI.CreateBodyFromShapeAndInfo2(sim.ptr, shape.ptr, id, constructionInfo)); 160 return new BulletBody(id, BSAPICPP.CreateBodyFromShapeAndInfo2(sim.ptr, shape.ptr, id, constructionInfo));
161} 161}
162 162
163public override bool DeleteCollisionShape(BulletWorld world, BulletShape shape) 163public override bool DeleteCollisionShape(BulletWorld world, BulletShape shape)
164{ 164{
165 return BSAPI.DeleteCollisionShape2(world.ptr, shape.ptr); 165 return BSAPICPP.DeleteCollisionShape2(world.ptr, shape.ptr);
166} 166}
167 167
168public override int GetBodyType(BulletBody obj) 168public override int GetBodyType(BulletBody obj)
169{ 169{
170 return BSAPI.GetBodyType2(obj.ptr); 170 return BSAPICPP.GetBodyType2(obj.ptr);
171} 171}
172 172
173public override BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot) 173public override BulletBody CreateBodyFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot)
174{ 174{
175 return new BulletBody(id, BSAPI.CreateBodyFromShape2(sim.ptr, shape.ptr, id, pos, rot)); 175 return new BulletBody(id, BSAPICPP.CreateBodyFromShape2(sim.ptr, shape.ptr, id, pos, rot));
176} 176}
177 177
178public override BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot) 178public override BulletBody CreateBodyWithDefaultMotionState(BulletShape shape, uint id, Vector3 pos, Quaternion rot)
179{ 179{
180 return new BulletBody(id, BSAPI.CreateBodyWithDefaultMotionState2(shape.ptr, id, pos, rot)); 180 return new BulletBody(id, BSAPICPP.CreateBodyWithDefaultMotionState2(shape.ptr, id, pos, rot));
181} 181}
182 182
183public override BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot) 183public override BulletBody CreateGhostFromShape(BulletWorld sim, BulletShape shape, uint id, Vector3 pos, Quaternion rot)
184{ 184{
185 return new BulletBody(id, BSAPI.CreateGhostFromShape2(sim.ptr, shape.ptr, id, pos, rot)); 185 return new BulletBody(id, BSAPICPP.CreateGhostFromShape2(sim.ptr, shape.ptr, id, pos, rot));
186} 186}
187 187
188public override IntPtr AllocateBodyInfo(BulletBody obj) 188public override IntPtr AllocateBodyInfo(BulletBody obj)
189{ 189{
190 return BSAPI.AllocateBodyInfo2(obj.ptr); 190 return BSAPICPP.AllocateBodyInfo2(obj.ptr);
191} 191}
192 192
193public override void ReleaseBodyInfo(IntPtr obj) 193public override void ReleaseBodyInfo(IntPtr obj)
194{ 194{
195 BSAPI.ReleaseBodyInfo2(obj); 195 BSAPICPP.ReleaseBodyInfo2(obj);
196} 196}
197 197
198public override void DestroyObject(BulletWorld sim, BulletBody obj) 198public override void DestroyObject(BulletWorld sim, BulletBody obj)
199{ 199{
200 BSAPI.DestroyObject2(sim.ptr, obj.ptr); 200 BSAPICPP.DestroyObject2(sim.ptr, obj.ptr);
201} 201}
202 202
203 /* 203// =====================================================================================
204// ===================================================================================== 204// Terrain creation and helper routines
205// Terrain creation and helper routines 205public override IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
206public override IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords, 206 float[] heightMap, float collisionMargin)
207 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 207{
208 208 return BSAPICPP.CreateHeightMapInfo2(sim.ptr, id, minCoords, maxCoords, heightMap, collisionMargin);
209public override IntPtr FillHeightMapInfo(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, 209}
210 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 210
211 211public override IntPtr FillHeightMapInfo(BulletWorld sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
212public override bool ReleaseHeightMapInfo(IntPtr heightMapInfo); 212 float[] heightMap, float collisionMargin)
213 213{
214public override BulletBody CreateGroundPlaneShape(uint id, float height, float collisionMargin); 214 return BSAPICPP.FillHeightMapInfo2(sim.ptr, mapInfo, id, minCoords, maxCoords, heightMap, collisionMargin);
215 215}
216public override BulletBody CreateTerrainShape(IntPtr mapInfo); 216
217 217public override bool ReleaseHeightMapInfo(IntPtr heightMapInfo)
218// ===================================================================================== 218{
219// Constraint creation and helper routines 219 return BSAPICPP.ReleaseHeightMapInfo2(heightMapInfo);
220public override BulletConstraint Create6DofConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, 220}
221 Vector3 frame1loc, Quaternion frame1rot, 221
222 Vector3 frame2loc, Quaternion frame2rot, 222public override BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin)
223 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); 223{
224 224 return new BulletShape(BSAPICPP.CreateGroundPlaneShape2(id, height, collisionMargin), BSPhysicsShapeType.SHAPE_GROUNDPLANE);
225public override BulletConstraint Create6DofConstraintToPoint(BulletWorld world, BulletBody obj1, BulletBody obj2, 225}
226 Vector3 joinPoint, 226
227 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); 227public override BulletShape CreateTerrainShape(IntPtr mapInfo)
228 228{
229public override BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2, 229 return new BulletShape(BSAPICPP.CreateTerrainShape2(mapInfo), BSPhysicsShapeType.SHAPE_TERRAIN);
230 Vector3 pivotinA, Vector3 pivotinB, 230}
231 Vector3 axisInA, Vector3 axisInB, 231
232 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); 232// =====================================================================================
233 233// Constraint creation and helper routines
234public override void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse); 234public override BulletConstraint Create6DofConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2,
235 235 Vector3 frame1loc, Quaternion frame1rot,
236public override void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations); 236 Vector3 frame2loc, Quaternion frame2rot,
237 237 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
238public override bool SetFrames(BulletConstraint constrain, 238{
239 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); 239 return new BulletConstraint(BSAPICPP.Create6DofConstraint2(world.ptr, obj1.ptr, obj2.ptr, frame1loc, frame1rot,
240 240 frame2loc, frame2rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
241public override bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi); 241}
242 242
243public override bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi); 243public override BulletConstraint Create6DofConstraintToPoint(BulletWorld world, BulletBody obj1, BulletBody obj2,
244 244 Vector3 joinPoint,
245public override bool UseFrameOffset(BulletConstraint constrain, float enable); 245 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
246 246{
247public override bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce); 247 return new BulletConstraint(BSAPICPP.Create6DofConstraintToPoint2(world.ptr, obj1.ptr, obj2.ptr,
248 248 joinPoint, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
249public override bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); 249}
250 250
251public override bool CalculateTransforms(BulletConstraint constrain); 251public override BulletConstraint CreateHingeConstraint(BulletWorld world, BulletBody obj1, BulletBody obj2,
252 252 Vector3 pivotinA, Vector3 pivotinB,
253public override bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); 253 Vector3 axisInA, Vector3 axisInB,
254 254 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
255public override bool DestroyConstraint(BulletWorld world, BulletConstraint constrain); 255{
256 256 return new BulletConstraint(BSAPICPP.CreateHingeConstraint2(world.ptr, obj1.ptr, obj2.ptr,
257// ===================================================================================== 257 pivotinA, pivotinB, axisInA, axisInB, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
258// btCollisionWorld entries 258}
259public override void UpdateSingleAabb(BulletWorld world, BulletBody obj); 259
260 260public override void SetConstraintEnable(BulletConstraint constrain, float numericTrueFalse)
261public override void UpdateAabbs(BulletWorld world); 261{
262 262 BSAPICPP.SetConstraintEnable2(constrain.ptr, numericTrueFalse);
263public override bool GetForceUpdateAllAabbs(BulletWorld world); 263}
264 264
265public override void SetForceUpdateAllAabbs(BulletWorld world, bool force); 265public override void SetConstraintNumSolverIterations(BulletConstraint constrain, float iterations)
266 266{
267// ===================================================================================== 267 BSAPICPP.SetConstraintNumSolverIterations2(constrain.ptr, iterations);
268// btDynamicsWorld entries 268}
269public override bool AddObjectToWorld(BulletWorld world, BulletBody obj); 269
270 270public override bool SetFrames(BulletConstraint constrain,
271public override bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj); 271 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot)
272 272{
273public override bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); 273 return BSAPICPP.SetFrames2(constrain.ptr, frameA, frameArot, frameB, frameBrot);
274 274}
275public override bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain); 275
276// ===================================================================================== 276public override bool SetLinearLimits(BulletConstraint constrain, Vector3 low, Vector3 hi)
277// btCollisionObject entries 277{
278public override Vector3 GetAnisotripicFriction(BulletConstraint constrain); 278 return BSAPICPP.SetLinearLimits2(constrain.ptr, low, hi);
279 279}
280public override Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict); 280
281 281public override bool SetAngularLimits(BulletConstraint constrain, Vector3 low, Vector3 hi)
282public override bool HasAnisotripicFriction(BulletConstraint constrain); 282{
283 283 return BSAPICPP.SetAngularLimits2(constrain.ptr, low, hi);
284public override void SetContactProcessingThreshold(BulletBody obj, float val); 284}
285 285
286public override float GetContactProcessingThreshold(BulletBody obj); 286public override bool UseFrameOffset(BulletConstraint constrain, float enable)
287 287{
288public override bool IsStaticObject(BulletBody obj); 288 return BSAPICPP.UseFrameOffset2(constrain.ptr, enable);
289 289}
290public override bool IsKinematicObject(BulletBody obj); 290
291 291public override bool TranslationalLimitMotor(BulletConstraint constrain, float enable, float targetVel, float maxMotorForce)
292public override bool IsStaticOrKinematicObject(BulletBody obj); 292{
293 293 return BSAPICPP.TranslationalLimitMotor2(constrain.ptr, enable, targetVel, maxMotorForce);
294public override bool HasContactResponse(BulletBody obj); 294}
295 295
296public override void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletBody shape); 296public override bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold)
297 297{
298public override BulletShape GetCollisionShape(BulletBody obj); 298 return BSAPICPP.SetBreakingImpulseThreshold2(constrain.ptr, threshold);
299 299}
300public override int GetActivationState(BulletBody obj); 300
301 301public override bool CalculateTransforms(BulletConstraint constrain)
302public override void SetActivationState(BulletBody obj, int state); 302{
303 303 return BSAPICPP.CalculateTransforms2(constrain.ptr);
304public override void SetDeactivationTime(BulletBody obj, float dtime); 304}
305 305
306public override float GetDeactivationTime(BulletBody obj); 306public override bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis)
307 307{
308public override void ForceActivationState(BulletBody obj, ActivationState state); 308 return BSAPICPP.SetConstraintParam2(constrain.ptr, paramIndex, value, axis);
309 309}
310public override void Activate(BulletBody obj, bool forceActivation); 310
311 311public override bool DestroyConstraint(BulletWorld world, BulletConstraint constrain)
312public override bool IsActive(BulletBody obj); 312{
313 313 return BSAPICPP.DestroyConstraint2(world.ptr, constrain.ptr);
314public override void SetRestitution(BulletBody obj, float val); 314}
315 315
316public override float GetRestitution(BulletBody obj); 316// =====================================================================================
317 317// btCollisionWorld entries
318public override void SetFriction(BulletBody obj, float val); 318public override void UpdateSingleAabb(BulletWorld world, BulletBody obj)
319 319{
320public override float GetFriction(BulletBody obj); 320 BSAPICPP.UpdateSingleAabb2(world.ptr, obj.ptr);
321 321}
322public override Vector3 GetPosition(BulletBody obj); 322
323 323public override void UpdateAabbs(BulletWorld world)
324public override Quaternion GetOrientation(BulletBody obj); 324{
325 325 BSAPICPP.UpdateAabbs2(world.ptr);
326public override void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation); 326}
327 327
328public override IntPtr GetBroadphaseHandle(BulletBody obj); 328public override bool GetForceUpdateAllAabbs(BulletWorld world)
329 329{
330public override void SetBroadphaseHandle(BulletBody obj, IntPtr handle); 330 return BSAPICPP.GetForceUpdateAllAabbs2(world.ptr);
331 331}
332public override void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel); 332
333 333public override void SetForceUpdateAllAabbs(BulletWorld world, bool force)
334public override void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel); 334{
335 335 BSAPICPP.SetForceUpdateAllAabbs2(world.ptr, force);
336public override void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel); 336}
337 337
338public override float GetHitFraction(BulletBody obj); 338// =====================================================================================
339 339// btDynamicsWorld entries
340public override void SetHitFraction(BulletBody obj, float val); 340public override bool AddObjectToWorld(BulletWorld world, BulletBody obj)
341 341{
342public override CollisionFlags GetCollisionFlags(BulletBody obj); 342 return BSAPICPP.AddObjectToWorld2(world.ptr, obj.ptr);
343 343}
344public override CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags); 344
345 345public override bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj)
346public override CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags); 346{
347 347 return BSAPICPP.RemoveObjectFromWorld2(world.ptr, obj.ptr);
348public override CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags); 348}
349 349
350public override float GetCcdMotionThreshold(BulletBody obj); 350public override bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects)
351 351{
352public override void SetCcdMotionThreshold(BulletBody obj, float val); 352 return BSAPICPP.AddConstraintToWorld2(world.ptr, constrain.ptr, disableCollisionsBetweenLinkedObjects);
353 353}
354public override float GetCcdSweptSphereRadius(BulletBody obj); 354
355 355public override bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain)
356public override void SetCcdSweptSphereRadius(BulletBody obj, float val); 356{
357 357 return BSAPICPP.RemoveConstraintFromWorld2(world.ptr, constrain.ptr);
358public override IntPtr GetUserPointer(BulletBody obj); 358}
359 359// =====================================================================================
360public override void SetUserPointer(BulletBody obj, IntPtr val); 360// btCollisionObject entries
361 361public override Vector3 GetAnisotripicFriction(BulletConstraint constrain)
362// ===================================================================================== 362{
363// btRigidBody entries 363 return BSAPICPP.GetAnisotripicFriction2(constrain.ptr);
364public override void ApplyGravity(BulletBody obj); 364}
365 365
366public override void SetGravity(BulletBody obj, Vector3 val); 366public override Vector3 SetAnisotripicFriction(BulletConstraint constrain, Vector3 frict)
367 367{
368public override Vector3 GetGravity(BulletBody obj); 368 return BSAPICPP.SetAnisotripicFriction2(constrain.ptr, frict);
369 369}
370public override void SetDamping(BulletBody obj, float lin_damping, float ang_damping); 370
371 371public override bool HasAnisotripicFriction(BulletConstraint constrain)
372public override void SetLinearDamping(BulletBody obj, float lin_damping); 372{
373 373 return BSAPICPP.HasAnisotripicFriction2(constrain.ptr);
374public override void SetAngularDamping(BulletBody obj, float ang_damping); 374}
375 375
376public override float GetLinearDamping(BulletBody obj); 376public override void SetContactProcessingThreshold(BulletBody obj, float val)
377 377{
378public override float GetAngularDamping(BulletBody obj); 378 BSAPICPP.SetContactProcessingThreshold2(obj.ptr, val);
379 379}
380public override float GetLinearSleepingThreshold(BulletBody obj); 380
381 381public override float GetContactProcessingThreshold(BulletBody obj)
382 382{
383public override void ApplyDamping(BulletBody obj, float timeStep); 383 return BSAPICPP.GetContactProcessingThreshold2(obj.ptr);
384 384}
385public override void SetMassProps(BulletBody obj, float mass, Vector3 inertia); 385
386 386public override bool IsStaticObject(BulletBody obj)
387public override Vector3 GetLinearFactor(BulletBody obj); 387{
388 388 return BSAPICPP.IsStaticObject2(obj.ptr);
389public override void SetLinearFactor(BulletBody obj, Vector3 factor); 389}
390 390
391public override void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot); 391public override bool IsKinematicObject(BulletBody obj)
392 392{
393// Add a force to the object as if its mass is one. 393 return BSAPICPP.IsKinematicObject2(obj.ptr);
394public override void ApplyCentralForce(BulletBody obj, Vector3 force); 394}
395 395
396// Set the force being applied to the object as if its mass is one. 396public override bool IsStaticOrKinematicObject(BulletBody obj)
397public override void SetObjectForce(BulletBody obj, Vector3 force); 397{
398 398 return BSAPICPP.IsStaticOrKinematicObject2(obj.ptr);
399public override Vector3 GetTotalForce(BulletBody obj); 399}
400 400
401public override Vector3 GetTotalTorque(BulletBody obj); 401public override bool HasContactResponse(BulletBody obj)
402 402{
403public override Vector3 GetInvInertiaDiagLocal(BulletBody obj); 403 return BSAPICPP.HasContactResponse2(obj.ptr);
404 404}
405public override void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert); 405
406 406public override void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletShape shape)
407public override void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold); 407{
408 408 BSAPICPP.SetCollisionShape2(sim.ptr, obj.ptr, shape.ptr);
409public override void ApplyTorque(BulletBody obj, Vector3 torque); 409}
410 410
411// Apply force at the given point. Will add torque to the object. 411public override BulletShape GetCollisionShape(BulletBody obj)
412public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos); 412{
413 413 return new BulletShape(BSAPICPP.GetCollisionShape2(obj.ptr));
414// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. 414}
415public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp); 415
416 416public override int GetActivationState(BulletBody obj)
417// Apply impulse to the object's torque. Force is scaled by object's mass. 417{
418public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp); 418 return BSAPICPP.GetActivationState2(obj.ptr);
419 419}
420// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. 420
421public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos); 421public override void SetActivationState(BulletBody obj, int state)
422 422{
423public override void ClearForces(BulletBody obj); 423 BSAPICPP.SetActivationState2(obj.ptr, state);
424 424}
425public override void ClearAllForces(BulletBody obj); 425
426 426public override void SetDeactivationTime(BulletBody obj, float dtime)
427public override void UpdateInertiaTensor(BulletBody obj); 427{
428 428 BSAPICPP.SetDeactivationTime2(obj.ptr, dtime);
429public override Vector3 GetLinearVelocity(BulletBody obj); 429}
430 430
431public override Vector3 GetAngularVelocity(BulletBody obj); 431public override float GetDeactivationTime(BulletBody obj)
432 432{
433public override void SetLinearVelocity(BulletBody obj, Vector3 val); 433 return BSAPICPP.GetDeactivationTime2(obj.ptr);
434 434}
435public override void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity); 435
436 436public override void ForceActivationState(BulletBody obj, ActivationState state)
437public override Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos); 437{
438 438 BSAPICPP.ForceActivationState2(obj.ptr, state);
439public override void Translate(BulletBody obj, Vector3 trans); 439}
440 440
441public override void UpdateDeactivation(BulletBody obj, float timeStep); 441public override void Activate(BulletBody obj, bool forceActivation)
442 442{
443public override bool WantsSleeping(BulletBody obj); 443 BSAPICPP.Activate2(obj.ptr, forceActivation);
444 444}
445public override void SetAngularFactor(BulletBody obj, float factor); 445
446 446public override bool IsActive(BulletBody obj)
447public override void SetAngularFactorV(BulletBody obj, Vector3 factor); 447{
448 448 return BSAPICPP.IsActive2(obj.ptr);
449public override Vector3 GetAngularFactor(BulletBody obj); 449}
450 450
451public override bool IsInWorld(BulletBody obj); 451public override void SetRestitution(BulletBody obj, float val)
452 452{
453public override void AddConstraintRef(BulletBody obj, BulletConstraint constrain); 453 BSAPICPP.SetRestitution2(obj.ptr, val);
454 454}
455public override void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain); 455
456 456public override float GetRestitution(BulletBody obj)
457public override BulletConstraint GetConstraintRef(BulletBody obj, int index); 457{
458 458 return BSAPICPP.GetRestitution2(obj.ptr);
459public override int GetNumConstraintRefs(BulletBody obj); 459}
460 460
461public override bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask); 461public override void SetFriction(BulletBody obj, float val)
462 462{
463// ===================================================================================== 463 BSAPICPP.SetFriction2(obj.ptr, val);
464// btCollisionShape entries 464}
465 465
466public override float GetAngularMotionDisc(BulletShape shape); 466public override float GetFriction(BulletBody obj)
467 467{
468public override float GetContactBreakingThreshold(BulletShape shape, float defaultFactor); 468 return BSAPICPP.GetFriction2(obj.ptr);
469 469}
470public override bool IsPolyhedral(BulletShape shape); 470
471 471public override Vector3 GetPosition(BulletBody obj)
472public override bool IsConvex2d(BulletShape shape); 472{
473 473 return BSAPICPP.GetPosition2(obj.ptr);
474public override bool IsConvex(BulletShape shape); 474}
475 475
476public override bool IsNonMoving(BulletShape shape); 476public override Quaternion GetOrientation(BulletBody obj)
477 477{
478public override bool IsConcave(BulletShape shape); 478 return BSAPICPP.GetOrientation2(obj.ptr);
479 479}
480public override bool IsCompound(BulletShape shape); 480
481 481public override void SetTranslation(BulletBody obj, Vector3 position, Quaternion rotation)
482public override bool IsSoftBody(BulletShape shape); 482{
483 483 BSAPICPP.SetTranslation2(obj.ptr, position, rotation);
484public override bool IsInfinite(BulletShape shape); 484}
485 485
486public override void SetLocalScaling(BulletShape shape, Vector3 scale); 486public override IntPtr GetBroadphaseHandle(BulletBody obj)
487 487{
488public override Vector3 GetLocalScaling(BulletShape shape); 488 return BSAPICPP.GetBroadphaseHandle2(obj.ptr);
489 489}
490public override Vector3 CalculateLocalInertia(BulletShape shape, float mass); 490
491 491public override void SetBroadphaseHandle(BulletBody obj, IntPtr handle)
492public override int GetShapeType(BulletShape shape); 492{
493 493 BSAPICPP.SetUserPointer2(obj.ptr, handle);
494public override void SetMargin(BulletShape shape, float val); 494}
495 495
496public override float GetMargin(BulletShape shape); 496public override void SetInterpolationLinearVelocity(BulletBody obj, Vector3 vel)
497 */ 497{
498 498 BSAPICPP.SetInterpolationLinearVelocity2(obj.ptr, vel);
499static class BSAPI 499}
500{ 500
501// ===================================================================================== 501public override void SetInterpolationAngularVelocity(BulletBody obj, Vector3 vel)
502// Mesh, hull, shape and body creation helper routines 502{
503[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 503 BSAPICPP.SetInterpolationAngularVelocity2(obj.ptr, vel);
504public static extern IntPtr CreateMeshShape2(IntPtr world, 504}
505 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices, 505
506 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices ); 506public override void SetInterpolationVelocity(BulletBody obj, Vector3 linearVel, Vector3 angularVel)
507 507{
508[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 508 BSAPICPP.SetInterpolationVelocity2(obj.ptr, linearVel, angularVel);
509public static extern IntPtr CreateHullShape2(IntPtr world, 509}
510 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls); 510
511 511public override float GetHitFraction(BulletBody obj)
512[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 512{
513public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape); 513 return BSAPICPP.GetHitFraction2(obj.ptr);
514 514}
515[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 515
516public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData); 516public override void SetHitFraction(BulletBody obj, float val)
517 517{
518[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 518 BSAPICPP.SetHitFraction2(obj.ptr, val);
519public static extern bool IsNativeShape2(IntPtr shape); 519}
520 520
521[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 521public override CollisionFlags GetCollisionFlags(BulletBody obj)
522public static extern void SetShapeCollisionMargin2(IntPtr shape, float margin); 522{
523 523 return BSAPICPP.GetCollisionFlags2(obj.ptr);
524[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 524}
525public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale); 525
526 526public override CollisionFlags SetCollisionFlags(BulletBody obj, CollisionFlags flags)
527[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 527{
528public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree); 528 return BSAPICPP.SetCollisionFlags2(obj.ptr, flags);
529 529}
530[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 530
531public static extern int GetNumberOfCompoundChildren2(IntPtr cShape); 531public override CollisionFlags AddToCollisionFlags(BulletBody obj, CollisionFlags flags)
532 532{
533[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 533 return BSAPICPP.AddToCollisionFlags2(obj.ptr, flags);
534public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot); 534}
535 535
536[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 536public override CollisionFlags RemoveFromCollisionFlags(BulletBody obj, CollisionFlags flags)
537public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); 537{
538 538 return BSAPICPP.RemoveFromCollisionFlags2(obj.ptr, flags);
539[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 539}
540public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx); 540
541 541public override float GetCcdMotionThreshold(BulletBody obj)
542[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 542{
543public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape); 543 return BSAPICPP.GetCcdMotionThreshold2(obj.ptr);
544 544}
545[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 545
546public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape); 546
547 547public override void SetCcdMotionThreshold(BulletBody obj, float val)
548[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 548{
549public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id); 549 BSAPICPP.SetCcdMotionThreshold2(obj.ptr, val);
550 550}
551[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 551
552public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo); 552public override float GetCcdSweptSphereRadius(BulletBody obj)
553 553{
554[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 554 return BSAPICPP.GetCcdSweptSphereRadius2(obj.ptr);
555public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape); 555}
556 556
557[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 557public override void SetCcdSweptSphereRadius(BulletBody obj, float val)
558public static extern int GetBodyType2(IntPtr obj); 558{
559 559 BSAPICPP.SetCcdSweptSphereRadius2(obj.ptr, val);
560[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 560}
561public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); 561
562 562public override IntPtr GetUserPointer(BulletBody obj)
563[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 563{
564public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot); 564 return BSAPICPP.GetUserPointer2(obj.ptr);
565 565}
566[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 566
567public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot); 567public override void SetUserPointer(BulletBody obj, IntPtr val)
568 568{
569[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 569 BSAPICPP.SetUserPointer2(obj.ptr, val);
570public static extern IntPtr AllocateBodyInfo2(IntPtr obj); 570}
571 571
572[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 572 /*
573public static extern void ReleaseBodyInfo2(IntPtr obj); 573// =====================================================================================
574 574// btRigidBody entries
575[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 575public override void ApplyGravity(BulletBody obj);
576public static extern void DestroyObject2(IntPtr sim, IntPtr obj); 576
577 577public override void SetGravity(BulletBody obj, Vector3 val);
578} 578
579} 579public override Vector3 GetGravity(BulletBody obj);
580 580
581// =============================================================================== 581public override void SetDamping(BulletBody obj, float lin_damping, float ang_damping);
582// =============================================================================== 582
583// =============================================================================== 583public override void SetLinearDamping(BulletBody obj, float lin_damping);
584// =============================================================================== 584
585// =============================================================================== 585public override void SetAngularDamping(BulletBody obj, float ang_damping);
586// =============================================================================== 586
587// =============================================================================== 587public override float GetLinearDamping(BulletBody obj);
588// =============================================================================== 588
589// =============================================================================== 589public override float GetAngularDamping(BulletBody obj);
590// =============================================================================== 590
591// =============================================================================== 591public override float GetLinearSleepingThreshold(BulletBody obj);
592// =============================================================================== 592
593// =============================================================================== 593
594static class BulletSimAPI { 594public override void ApplyDamping(BulletBody obj, float timeStep);
595// =============================================================================== 595
596// Link back to the managed code for outputting log messages 596public override void SetMassProps(BulletBody obj, float mass, Vector3 inertia);
597[UnmanagedFunctionPointer(CallingConvention.Cdecl)] 597
598public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg); 598public override Vector3 GetLinearFactor(BulletBody obj);
599 599
600// =============================================================================== 600public override void SetLinearFactor(BulletBody obj, Vector3 factor);
601// Initialization and simulation 601
602[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 602public override void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quaternion rot);
603public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms, 603
604 int maxCollisions, IntPtr collisionArray, 604// Add a force to the object as if its mass is one.
605 int maxUpdates, IntPtr updateArray, 605public override void ApplyCentralForce(BulletBody obj, Vector3 force);
606 DebugLogCallback logRoutine); 606
607 607// Set the force being applied to the object as if its mass is one.
608[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 608public override void SetObjectForce(BulletBody obj, Vector3 force);
609public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value); 609
610 610public override Vector3 GetTotalForce(BulletBody obj);
611[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 611
612public static extern void SetHeightMap2(IntPtr world, float[] heightmap); 612public override Vector3 GetTotalTorque(BulletBody obj);
613 613
614[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 614public override Vector3 GetInvInertiaDiagLocal(BulletBody obj);
615public static extern void Shutdown2(IntPtr sim); 615
616 616public override void SetInvInertiaDiagLocal(BulletBody obj, Vector3 inert);
617[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 617
618public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep, 618public override void SetSleepingThresholds(BulletBody obj, float lin_threshold, float ang_threshold);
619 out int updatedEntityCount, 619
620 out IntPtr updatedEntitiesPtr, 620public override void ApplyTorque(BulletBody obj, Vector3 torque);
621 out int collidersCount, 621
622 out IntPtr collidersPtr); 622// Apply force at the given point. Will add torque to the object.
623 623public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos);
624[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 624
625public static extern bool PushUpdate2(IntPtr obj); 625// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
626 626public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp);
627// ===================================================================================== 627
628// Terrain creation and helper routines 628// Apply impulse to the object's torque. Force is scaled by object's mass.
629[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 629public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp);
630public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords, 630
631 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 631// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
632 632public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos);
633[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 633
634public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords, 634public override void ClearForces(BulletBody obj);
635 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin); 635
636 636public override void ClearAllForces(BulletBody obj);
637[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 637
638public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo); 638public override void UpdateInertiaTensor(BulletBody obj);
639 639
640[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 640public override Vector3 GetLinearVelocity(BulletBody obj);
641public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin); 641
642 642public override Vector3 GetAngularVelocity(BulletBody obj);
643[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 643
644public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo); 644public override void SetLinearVelocity(BulletBody obj, Vector3 val);
645 645
646// ===================================================================================== 646public override void SetAngularVelocity(BulletBody obj, Vector3 angularVelocity);
647// Constraint creation and helper routines 647
648[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 648public override Vector3 GetVelocityInLocalPoint(BulletBody obj, Vector3 pos);
649public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, 649
650 Vector3 frame1loc, Quaternion frame1rot, 650public override void Translate(BulletBody obj, Vector3 trans);
651 Vector3 frame2loc, Quaternion frame2rot, 651
652 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); 652public override void UpdateDeactivation(BulletBody obj, float timeStep);
653 653
654[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 654public override bool WantsSleeping(BulletBody obj);
655public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr obj1, IntPtr obj2, 655
656 Vector3 joinPoint, 656public override void SetAngularFactor(BulletBody obj, float factor);
657 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); 657
658 658public override void SetAngularFactorV(BulletBody obj, Vector3 factor);
659[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 659
660public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2, 660public override Vector3 GetAngularFactor(BulletBody obj);
661 Vector3 pivotinA, Vector3 pivotinB, 661
662 Vector3 axisInA, Vector3 axisInB, 662public override bool IsInWorld(BulletBody obj);
663 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies); 663
664 664public override void AddConstraintRef(BulletBody obj, BulletConstraint constrain);
665[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 665
666public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse); 666public override void RemoveConstraintRef(BulletBody obj, BulletConstraint constrain);
667 667
668[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 668public override BulletConstraint GetConstraintRef(BulletBody obj, int index);
669public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations); 669
670 670public override int GetNumConstraintRefs(BulletBody obj);
671[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 671
672public static extern bool SetFrames2(IntPtr constrain, 672public override bool SetCollisionGroupMask(BulletBody body, uint filter, uint mask);
673 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot); 673
674 674// =====================================================================================
675[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 675// btCollisionShape entries
676public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi); 676
677 677public override float GetAngularMotionDisc(BulletShape shape);
678[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 678
679public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi); 679public override float GetContactBreakingThreshold(BulletShape shape, float defaultFactor);
680 680
681[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 681public override bool IsPolyhedral(BulletShape shape);
682public static extern bool UseFrameOffset2(IntPtr constrain, float enable); 682
683 683public override bool IsConvex2d(BulletShape shape);
684[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 684
685public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce); 685public override bool IsConvex(BulletShape shape);
686 686
687[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 687public override bool IsNonMoving(BulletShape shape);
688public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold); 688
689 689public override bool IsConcave(BulletShape shape);
690[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 690
691public static extern bool CalculateTransforms2(IntPtr constrain); 691public override bool IsCompound(BulletShape shape);
692 692
693[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 693public override bool IsSoftBody(BulletShape shape);
694public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); 694
695 695public override bool IsInfinite(BulletShape shape);
696[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 696
697public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain); 697public override void SetLocalScaling(BulletShape shape, Vector3 scale);
698 698
699// ===================================================================================== 699public override Vector3 GetLocalScaling(BulletShape shape);
700// btCollisionWorld entries 700
701[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 701public override Vector3 CalculateLocalInertia(BulletShape shape, float mass);
702public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj); 702
703 703public override int GetShapeType(BulletShape shape);
704[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 704
705public static extern void UpdateAabbs2(IntPtr world); 705public override void SetMargin(BulletShape shape, float val);
706 706
707[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 707public override float GetMargin(BulletShape shape);
708public static extern bool GetForceUpdateAllAabbs2(IntPtr world); 708 */
709 709
710[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 710static class BSAPICPP
711public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force); 711{
712 712// =====================================================================================
713// ===================================================================================== 713// Mesh, hull, shape and body creation helper routines
714// btDynamicsWorld entries 714[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
715[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 715public static extern IntPtr CreateMeshShape2(IntPtr world,
716public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); 716 int indicesCount, [MarshalAs(UnmanagedType.LPArray)] int[] indices,
717 717 int verticesCount, [MarshalAs(UnmanagedType.LPArray)] float[] vertices );
718[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 718
719public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); 719[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
720 720public static extern IntPtr CreateHullShape2(IntPtr world,
721[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 721 int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
722public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects); 722
723 723[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
724[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 724public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape);
725public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain); 725
726// ===================================================================================== 726[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
727// btCollisionObject entries 727public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData);
728[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 728
729public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain); 729[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
730 730public static extern bool IsNativeShape2(IntPtr shape);
731[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 731
732public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict); 732[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
733 733public static extern void SetShapeCollisionMargin2(IntPtr shape, float margin);
734[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 734
735public static extern bool HasAnisotripicFriction2(IntPtr constrain); 735[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
736 736public static extern IntPtr BuildCapsuleShape2(IntPtr world, float radius, float height, Vector3 scale);
737[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 737
738public static extern void SetContactProcessingThreshold2(IntPtr obj, float val); 738[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
739 739public static extern IntPtr CreateCompoundShape2(IntPtr sim, bool enableDynamicAabbTree);
740[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 740
741public static extern float GetContactProcessingThreshold2(IntPtr obj); 741[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
742 742public static extern int GetNumberOfCompoundChildren2(IntPtr cShape);
743[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 743
744public static extern bool IsStaticObject2(IntPtr obj); 744[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
745 745public static extern void AddChildShapeToCompoundShape2(IntPtr cShape, IntPtr addShape, Vector3 pos, Quaternion rot);
746[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 746
747public static extern bool IsKinematicObject2(IntPtr obj); 747[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
748 748public static extern IntPtr GetChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx);
749[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 749
750public static extern bool IsStaticOrKinematicObject2(IntPtr obj); 750[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
751 751public static extern IntPtr RemoveChildShapeFromCompoundShapeIndex2(IntPtr cShape, int indx);
752[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 752
753public static extern bool HasContactResponse2(IntPtr obj); 753[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
754 754public static extern void RemoveChildShapeFromCompoundShape2(IntPtr cShape, IntPtr removeShape);
755[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 755
756public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape); 756[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
757 757public static extern void RecalculateCompoundShapeLocalAabb2(IntPtr cShape);
758[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 758
759public static extern IntPtr GetCollisionShape2(IntPtr obj); 759[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
760 760public static extern IntPtr DuplicateCollisionShape2(IntPtr sim, IntPtr srcShape, uint id);
761[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 761
762public static extern int GetActivationState2(IntPtr obj); 762[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
763 763public static extern IntPtr CreateBodyFromShapeAndInfo2(IntPtr sim, IntPtr shape, uint id, IntPtr constructionInfo);
764[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 764
765public static extern void SetActivationState2(IntPtr obj, int state); 765[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
766 766public static extern bool DeleteCollisionShape2(IntPtr world, IntPtr shape);
767[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 767
768public static extern void SetDeactivationTime2(IntPtr obj, float dtime); 768[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
769 769public static extern int GetBodyType2(IntPtr obj);
770[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 770
771public static extern float GetDeactivationTime2(IntPtr obj); 771[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
772 772public static extern IntPtr CreateBodyFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
773[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 773
774public static extern void ForceActivationState2(IntPtr obj, ActivationState state); 774[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
775 775public static extern IntPtr CreateBodyWithDefaultMotionState2(IntPtr shape, uint id, Vector3 pos, Quaternion rot);
776[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 776
777public static extern void Activate2(IntPtr obj, bool forceActivation); 777[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
778 778public static extern IntPtr CreateGhostFromShape2(IntPtr sim, IntPtr shape, uint id, Vector3 pos, Quaternion rot);
779[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 779
780public static extern bool IsActive2(IntPtr obj); 780[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
781 781public static extern IntPtr AllocateBodyInfo2(IntPtr obj);
782[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 782
783public static extern void SetRestitution2(IntPtr obj, float val); 783[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
784 784public static extern void ReleaseBodyInfo2(IntPtr obj);
785[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 785
786public static extern float GetRestitution2(IntPtr obj); 786[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
787 787public static extern void DestroyObject2(IntPtr sim, IntPtr obj);
788[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 788
789public static extern void SetFriction2(IntPtr obj, float val); 789// =====================================================================================
790 790// Terrain creation and helper routines
791[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 791[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
792public static extern float GetFriction2(IntPtr obj); 792public static extern IntPtr CreateHeightMapInfo2(IntPtr sim, uint id, Vector3 minCoords, Vector3 maxCoords,
793 793 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
794 /* Haven't defined the type 'Transform' 794
795[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 795[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
796public static extern Transform GetWorldTransform2(IntPtr obj); 796public static extern IntPtr FillHeightMapInfo2(IntPtr sim, IntPtr mapInfo, uint id, Vector3 minCoords, Vector3 maxCoords,
797 797 [MarshalAs(UnmanagedType.LPArray)] float[] heightMap, float collisionMargin);
798[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 798
799public static extern void setWorldTransform2(IntPtr obj, Transform trans); 799[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
800 */ 800public static extern bool ReleaseHeightMapInfo2(IntPtr heightMapInfo);
801 801
802[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 802[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
803public static extern Vector3 GetPosition2(IntPtr obj); 803public static extern IntPtr CreateGroundPlaneShape2(uint id, float height, float collisionMargin);
804 804
805[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 805[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
806public static extern Quaternion GetOrientation2(IntPtr obj); 806public static extern IntPtr CreateTerrainShape2(IntPtr mapInfo);
807 807
808[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 808// =====================================================================================
809public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation); 809// Constraint creation and helper routines
810 810[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
811[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 811public static extern IntPtr Create6DofConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
812public static extern IntPtr GetBroadphaseHandle2(IntPtr obj); 812 Vector3 frame1loc, Quaternion frame1rot,
813 813 Vector3 frame2loc, Quaternion frame2rot,
814[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 814 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
815public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle); 815
816 816[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
817 /* 817public static extern IntPtr Create6DofConstraintToPoint2(IntPtr world, IntPtr obj1, IntPtr obj2,
818[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 818 Vector3 joinPoint,
819public static extern Transform GetInterpolationWorldTransform2(IntPtr obj); 819 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
820 820
821[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 821[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
822public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans); 822public static extern IntPtr CreateHingeConstraint2(IntPtr world, IntPtr obj1, IntPtr obj2,
823 */ 823 Vector3 pivotinA, Vector3 pivotinB,
824 824 Vector3 axisInA, Vector3 axisInB,
825[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 825 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies);
826public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel); 826
827 827[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
828[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 828public static extern void SetConstraintEnable2(IntPtr constrain, float numericTrueFalse);
829public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel); 829
830 830[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
831[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 831public static extern void SetConstraintNumSolverIterations2(IntPtr constrain, float iterations);
832public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel); 832
833 833[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
834[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 834public static extern bool SetFrames2(IntPtr constrain,
835public static extern float GetHitFraction2(IntPtr obj); 835 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
836 836
837[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 837[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
838public static extern void SetHitFraction2(IntPtr obj, float val); 838public static extern bool SetLinearLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
839 839
840[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 840[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
841public static extern CollisionFlags GetCollisionFlags2(IntPtr obj); 841public static extern bool SetAngularLimits2(IntPtr constrain, Vector3 low, Vector3 hi);
842 842
843[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 843[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
844public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags); 844public static extern bool UseFrameOffset2(IntPtr constrain, float enable);
845 845
846[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 846[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
847public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags); 847public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enable, float targetVel, float maxMotorForce);
848 848
849[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 849[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
850public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags); 850public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold);
851 851
852[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 852[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
853public static extern float GetCcdMotionThreshold2(IntPtr obj); 853public static extern bool CalculateTransforms2(IntPtr constrain);
854 854
855[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 855[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
856public static extern void SetCcdMotionThreshold2(IntPtr obj, float val); 856public static extern bool SetConstraintParam2(IntPtr constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis);
857 857
858[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 858[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
859public static extern float GetCcdSweptSphereRadius2(IntPtr obj); 859public static extern bool DestroyConstraint2(IntPtr world, IntPtr constrain);
860 860
861[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 861// =====================================================================================
862public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val); 862// btCollisionWorld entries
863 863[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
864[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 864public static extern void UpdateSingleAabb2(IntPtr world, IntPtr obj);
865public static extern IntPtr GetUserPointer2(IntPtr obj); 865
866 866[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
867[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 867public static extern void UpdateAabbs2(IntPtr world);
868public static extern void SetUserPointer2(IntPtr obj, IntPtr val); 868
869 869[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
870// ===================================================================================== 870public static extern bool GetForceUpdateAllAabbs2(IntPtr world);
871// btRigidBody entries 871
872[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 872[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
873public static extern void ApplyGravity2(IntPtr obj); 873public static extern void SetForceUpdateAllAabbs2(IntPtr world, bool force);
874 874
875[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 875// =====================================================================================
876public static extern void SetGravity2(IntPtr obj, Vector3 val); 876// btDynamicsWorld entries
877 877[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
878[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 878public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj);
879public static extern Vector3 GetGravity2(IntPtr obj); 879
880 880[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
881[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 881public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj);
882public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping); 882
883 883[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
884[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 884public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects);
885public static extern void SetLinearDamping2(IntPtr obj, float lin_damping); 885
886 886[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
887[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 887public static extern bool RemoveConstraintFromWorld2(IntPtr world, IntPtr constrain);
888public static extern void SetAngularDamping2(IntPtr obj, float ang_damping); 888// =====================================================================================
889 889// btCollisionObject entries
890[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 890[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
891public static extern float GetLinearDamping2(IntPtr obj); 891public static extern Vector3 GetAnisotripicFriction2(IntPtr constrain);
892 892
893[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 893[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
894public static extern float GetAngularDamping2(IntPtr obj); 894public static extern Vector3 SetAnisotripicFriction2(IntPtr constrain, Vector3 frict);
895 895
896[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 896[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
897public static extern float GetLinearSleepingThreshold2(IntPtr obj); 897public static extern bool HasAnisotripicFriction2(IntPtr constrain);
898 898
899[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 899[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
900public static extern float GetAngularSleepingThreshold2(IntPtr obj); 900public static extern void SetContactProcessingThreshold2(IntPtr obj, float val);
901 901
902[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 902[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
903public static extern void ApplyDamping2(IntPtr obj, float timeStep); 903public static extern float GetContactProcessingThreshold2(IntPtr obj);
904 904
905[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 905[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
906public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia); 906public static extern bool IsStaticObject2(IntPtr obj);
907 907
908[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 908[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
909public static extern Vector3 GetLinearFactor2(IntPtr obj); 909public static extern bool IsKinematicObject2(IntPtr obj);
910 910
911[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 911[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
912public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor); 912public static extern bool IsStaticOrKinematicObject2(IntPtr obj);
913 913
914 /* 914[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
915[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 915public static extern bool HasContactResponse2(IntPtr obj);
916public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans); 916
917 */ 917[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
918 918public static extern void SetCollisionShape2(IntPtr sim, IntPtr obj, IntPtr shape);
919[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 919
920public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot); 920[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
921 921public static extern IntPtr GetCollisionShape2(IntPtr obj);
922// Add a force to the object as if its mass is one. 922
923[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 923[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
924public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force); 924public static extern int GetActivationState2(IntPtr obj);
925 925
926// Set the force being applied to the object as if its mass is one. 926[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
927[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 927public static extern void SetActivationState2(IntPtr obj, int state);
928public static extern void SetObjectForce2(IntPtr obj, Vector3 force); 928
929 929[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
930[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 930public static extern void SetDeactivationTime2(IntPtr obj, float dtime);
931public static extern Vector3 GetTotalForce2(IntPtr obj); 931
932 932[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
933[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 933public static extern float GetDeactivationTime2(IntPtr obj);
934public static extern Vector3 GetTotalTorque2(IntPtr obj); 934
935 935[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
936[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 936public static extern void ForceActivationState2(IntPtr obj, ActivationState state);
937public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj); 937
938 938[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
939[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 939public static extern void Activate2(IntPtr obj, bool forceActivation);
940public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert); 940
941 941[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
942[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 942public static extern bool IsActive2(IntPtr obj);
943public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold); 943
944 944[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
945[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 945public static extern void SetRestitution2(IntPtr obj, float val);
946public static extern void ApplyTorque2(IntPtr obj, Vector3 torque); 946
947 947[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
948// Apply force at the given point. Will add torque to the object. 948public static extern float GetRestitution2(IntPtr obj);
949[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 949
950public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos); 950[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
951 951public static extern void SetFriction2(IntPtr obj, float val);
952// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. 952
953[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 953[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
954public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp); 954public static extern float GetFriction2(IntPtr obj);
955 955
956// Apply impulse to the object's torque. Force is scaled by object's mass. 956 /* Haven't defined the type 'Transform'
957[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 957[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
958public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp); 958public static extern Transform GetWorldTransform2(IntPtr obj);
959 959
960// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. 960[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
961[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 961public static extern void setWorldTransform2(IntPtr obj, Transform trans);
962public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos); 962 */
963 963
964[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 964[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
965public static extern void ClearForces2(IntPtr obj); 965public static extern Vector3 GetPosition2(IntPtr obj);
966 966
967[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 967[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
968public static extern void ClearAllForces2(IntPtr obj); 968public static extern Quaternion GetOrientation2(IntPtr obj);
969 969
970[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 970[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
971public static extern void UpdateInertiaTensor2(IntPtr obj); 971public static extern void SetTranslation2(IntPtr obj, Vector3 position, Quaternion rotation);
972 972
973[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 973[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
974public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj); 974public static extern IntPtr GetBroadphaseHandle2(IntPtr obj);
975 975
976 /* 976[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
977[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 977public static extern void SetBroadphaseHandle2(IntPtr obj, IntPtr handle);
978public static extern Transform GetCenterOfMassTransform2(IntPtr obj); 978
979 */ 979 /*
980 980[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
981[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 981public static extern Transform GetInterpolationWorldTransform2(IntPtr obj);
982public static extern Vector3 GetLinearVelocity2(IntPtr obj); 982
983 983[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
984[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 984public static extern void SetInterpolationWorldTransform2(IntPtr obj, Transform trans);
985public static extern Vector3 GetAngularVelocity2(IntPtr obj); 985 */
986 986
987[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 987[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
988public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val); 988public static extern void SetInterpolationLinearVelocity2(IntPtr obj, Vector3 vel);
989 989
990[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 990[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
991public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity); 991public static extern void SetInterpolationAngularVelocity2(IntPtr obj, Vector3 vel);
992 992
993[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 993[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
994public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos); 994public static extern void SetInterpolationVelocity2(IntPtr obj, Vector3 linearVel, Vector3 angularVel);
995 995
996[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 996[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
997public static extern void Translate2(IntPtr obj, Vector3 trans); 997public static extern float GetHitFraction2(IntPtr obj);
998 998
999[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 999[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1000public static extern void UpdateDeactivation2(IntPtr obj, float timeStep); 1000public static extern void SetHitFraction2(IntPtr obj, float val);
1001 1001
1002[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1002[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1003public static extern bool WantsSleeping2(IntPtr obj); 1003public static extern CollisionFlags GetCollisionFlags2(IntPtr obj);
1004 1004
1005[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1005[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1006public static extern void SetAngularFactor2(IntPtr obj, float factor); 1006public static extern CollisionFlags SetCollisionFlags2(IntPtr obj, CollisionFlags flags);
1007 1007
1008[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1008[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1009public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor); 1009public static extern CollisionFlags AddToCollisionFlags2(IntPtr obj, CollisionFlags flags);
1010 1010
1011[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1011[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1012public static extern Vector3 GetAngularFactor2(IntPtr obj); 1012public static extern CollisionFlags RemoveFromCollisionFlags2(IntPtr obj, CollisionFlags flags);
1013 1013
1014[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1014[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1015public static extern bool IsInWorld2(IntPtr obj); 1015public static extern float GetCcdMotionThreshold2(IntPtr obj);
1016 1016
1017[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1017[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1018public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain); 1018public static extern void SetCcdMotionThreshold2(IntPtr obj, float val);
1019 1019
1020[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1020[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1021public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain); 1021public static extern float GetCcdSweptSphereRadius2(IntPtr obj);
1022 1022
1023[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1023[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1024public static extern IntPtr GetConstraintRef2(IntPtr obj, int index); 1024public static extern void SetCcdSweptSphereRadius2(IntPtr obj, float val);
1025 1025
1026[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1026[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1027public static extern int GetNumConstraintRefs2(IntPtr obj); 1027public static extern IntPtr GetUserPointer2(IntPtr obj);
1028 1028
1029[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1029[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1030public static extern bool SetCollisionGroupMask2(IntPtr body, uint filter, uint mask); 1030public static extern void SetUserPointer2(IntPtr obj, IntPtr val);
1031 1031
1032// ===================================================================================== 1032}
1033// btCollisionShape entries 1033}
1034 1034
1035[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1035// ===============================================================================
1036public static extern float GetAngularMotionDisc2(IntPtr shape); 1036// ===============================================================================
1037 1037// ===============================================================================
1038[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1038// ===============================================================================
1039public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor); 1039// ===============================================================================
1040 1040// ===============================================================================
1041[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1041// ===============================================================================
1042public static extern bool IsPolyhedral2(IntPtr shape); 1042// ===============================================================================
1043 1043// ===============================================================================
1044[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1044// ===============================================================================
1045public static extern bool IsConvex2d2(IntPtr shape); 1045// ===============================================================================
1046 1046// ===============================================================================
1047[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1047// ===============================================================================
1048public static extern bool IsConvex2(IntPtr shape); 1048static class BulletSimAPI {
1049 1049// ===============================================================================
1050[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1050// Link back to the managed code for outputting log messages
1051public static extern bool IsNonMoving2(IntPtr shape); 1051[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
1052 1052public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg);
1053[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1053
1054public static extern bool IsConcave2(IntPtr shape); 1054// ===============================================================================
1055 1055// Initialization and simulation
1056[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1056[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1057public static extern bool IsCompound2(IntPtr shape); 1057public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
1058 1058 int maxCollisions, IntPtr collisionArray,
1059[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1059 int maxUpdates, IntPtr updateArray,
1060public static extern bool IsSoftBody2(IntPtr shape); 1060 DebugLogCallback logRoutine);
1061 1061
1062[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1062[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1063public static extern bool IsInfinite2(IntPtr shape); 1063public static extern bool UpdateParameter2(IntPtr world, uint localID, String parm, float value);
1064 1064
1065[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1065[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1066public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale); 1066public static extern void SetHeightMap2(IntPtr world, float[] heightmap);
1067 1067
1068[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1068[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1069public static extern Vector3 GetLocalScaling2(IntPtr shape); 1069public static extern void Shutdown2(IntPtr sim);
1070 1070
1071[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1071[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1072public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass); 1072public static extern int PhysicsStep2(IntPtr world, float timeStep, int maxSubSteps, float fixedTimeStep,
1073 1073 out int updatedEntityCount,
1074[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1074 out IntPtr updatedEntitiesPtr,
1075public static extern int GetShapeType2(IntPtr shape); 1075 out int collidersCount,
1076 1076 out IntPtr collidersPtr);
1077[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1077
1078public static extern void SetMargin2(IntPtr shape, float val); 1078[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1079 1079public static extern bool PushUpdate2(IntPtr obj);
1080[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1080
1081public static extern float GetMargin2(IntPtr shape); 1081// =====================================================================================
1082 1082// btRigidBody entries
1083// ===================================================================================== 1083[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1084// Debugging 1084public static extern void ApplyGravity2(IntPtr obj);
1085[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1085
1086public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject); 1086[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1087 1087public static extern void SetGravity2(IntPtr obj, Vector3 val);
1088[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1088
1089public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape); 1089[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1090 1090public static extern Vector3 GetGravity2(IntPtr obj);
1091[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1091
1092public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo); 1092[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1093 1093public static extern void SetDamping2(IntPtr obj, float lin_damping, float ang_damping);
1094[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1094
1095public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain); 1095[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1096 1096public static extern void SetLinearDamping2(IntPtr obj, float lin_damping);
1097[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1097
1098public static extern void DumpActivationInfo2(IntPtr sim); 1098[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1099 1099public static extern void SetAngularDamping2(IntPtr obj, float ang_damping);
1100[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1100
1101public static extern void DumpAllInfo2(IntPtr sim); 1101[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1102 1102public static extern float GetLinearDamping2(IntPtr obj);
1103[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 1103
1104public static extern void DumpPhysicsStatistics2(IntPtr sim); 1104[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1105 1105public static extern float GetAngularDamping2(IntPtr obj);
1106} 1106
1107} 1107[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1108public static extern float GetLinearSleepingThreshold2(IntPtr obj);
1109
1110[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1111public static extern float GetAngularSleepingThreshold2(IntPtr obj);
1112
1113[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1114public static extern void ApplyDamping2(IntPtr obj, float timeStep);
1115
1116[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1117public static extern void SetMassProps2(IntPtr obj, float mass, Vector3 inertia);
1118
1119[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1120public static extern Vector3 GetLinearFactor2(IntPtr obj);
1121
1122[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1123public static extern void SetLinearFactor2(IntPtr obj, Vector3 factor);
1124
1125 /*
1126[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1127public static extern void SetCenterOfMassTransform2(IntPtr obj, Transform trans);
1128 */
1129
1130[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1131public static extern void SetCenterOfMassByPosRot2(IntPtr obj, Vector3 pos, Quaternion rot);
1132
1133// Add a force to the object as if its mass is one.
1134[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1135public static extern void ApplyCentralForce2(IntPtr obj, Vector3 force);
1136
1137// Set the force being applied to the object as if its mass is one.
1138[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1139public static extern void SetObjectForce2(IntPtr obj, Vector3 force);
1140
1141[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1142public static extern Vector3 GetTotalForce2(IntPtr obj);
1143
1144[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1145public static extern Vector3 GetTotalTorque2(IntPtr obj);
1146
1147[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1148public static extern Vector3 GetInvInertiaDiagLocal2(IntPtr obj);
1149
1150[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1151public static extern void SetInvInertiaDiagLocal2(IntPtr obj, Vector3 inert);
1152
1153[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1154public static extern void SetSleepingThresholds2(IntPtr obj, float lin_threshold, float ang_threshold);
1155
1156[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1157public static extern void ApplyTorque2(IntPtr obj, Vector3 torque);
1158
1159// Apply force at the given point. Will add torque to the object.
1160[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1161public static extern void ApplyForce2(IntPtr obj, Vector3 force, Vector3 pos);
1162
1163// Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass.
1164[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1165public static extern void ApplyCentralImpulse2(IntPtr obj, Vector3 imp);
1166
1167// Apply impulse to the object's torque. Force is scaled by object's mass.
1168[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1169public static extern void ApplyTorqueImpulse2(IntPtr obj, Vector3 imp);
1170
1171// Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces.
1172[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1173public static extern void ApplyImpulse2(IntPtr obj, Vector3 imp, Vector3 pos);
1174
1175[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1176public static extern void ClearForces2(IntPtr obj);
1177
1178[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1179public static extern void ClearAllForces2(IntPtr obj);
1180
1181[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1182public static extern void UpdateInertiaTensor2(IntPtr obj);
1183
1184[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1185public static extern Vector3 GetCenterOfMassPosition2(IntPtr obj);
1186
1187 /*
1188[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1189public static extern Transform GetCenterOfMassTransform2(IntPtr obj);
1190 */
1191
1192[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1193public static extern Vector3 GetLinearVelocity2(IntPtr obj);
1194
1195[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1196public static extern Vector3 GetAngularVelocity2(IntPtr obj);
1197
1198[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1199public static extern void SetLinearVelocity2(IntPtr obj, Vector3 val);
1200
1201[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1202public static extern void SetAngularVelocity2(IntPtr obj, Vector3 angularVelocity);
1203
1204[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1205public static extern Vector3 GetVelocityInLocalPoint2(IntPtr obj, Vector3 pos);
1206
1207[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1208public static extern void Translate2(IntPtr obj, Vector3 trans);
1209
1210[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1211public static extern void UpdateDeactivation2(IntPtr obj, float timeStep);
1212
1213[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1214public static extern bool WantsSleeping2(IntPtr obj);
1215
1216[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1217public static extern void SetAngularFactor2(IntPtr obj, float factor);
1218
1219[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1220public static extern void SetAngularFactorV2(IntPtr obj, Vector3 factor);
1221
1222[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1223public static extern Vector3 GetAngularFactor2(IntPtr obj);
1224
1225[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1226public static extern bool IsInWorld2(IntPtr obj);
1227
1228[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1229public static extern void AddConstraintRef2(IntPtr obj, IntPtr constrain);
1230
1231[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1232public static extern void RemoveConstraintRef2(IntPtr obj, IntPtr constrain);
1233
1234[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1235public static extern IntPtr GetConstraintRef2(IntPtr obj, int index);
1236
1237[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1238public static extern int GetNumConstraintRefs2(IntPtr obj);
1239
1240[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1241public static extern bool SetCollisionGroupMask2(IntPtr body, uint filter, uint mask);
1242
1243// =====================================================================================
1244// btCollisionShape entries
1245
1246[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1247public static extern float GetAngularMotionDisc2(IntPtr shape);
1248
1249[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1250public static extern float GetContactBreakingThreshold2(IntPtr shape, float defaultFactor);
1251
1252[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1253public static extern bool IsPolyhedral2(IntPtr shape);
1254
1255[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1256public static extern bool IsConvex2d2(IntPtr shape);
1257
1258[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1259public static extern bool IsConvex2(IntPtr shape);
1260
1261[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1262public static extern bool IsNonMoving2(IntPtr shape);
1263
1264[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1265public static extern bool IsConcave2(IntPtr shape);
1266
1267[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1268public static extern bool IsCompound2(IntPtr shape);
1269
1270[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1271public static extern bool IsSoftBody2(IntPtr shape);
1272
1273[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1274public static extern bool IsInfinite2(IntPtr shape);
1275
1276[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1277public static extern void SetLocalScaling2(IntPtr shape, Vector3 scale);
1278
1279[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1280public static extern Vector3 GetLocalScaling2(IntPtr shape);
1281
1282[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1283public static extern Vector3 CalculateLocalInertia2(IntPtr shape, float mass);
1284
1285[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1286public static extern int GetShapeType2(IntPtr shape);
1287
1288[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1289public static extern void SetMargin2(IntPtr shape, float val);
1290
1291[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1292public static extern float GetMargin2(IntPtr shape);
1293
1294// =====================================================================================
1295// Debugging
1296[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1297public static extern void DumpRigidBody2(IntPtr sim, IntPtr collisionObject);
1298
1299[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1300public static extern void DumpCollisionShape2(IntPtr sim, IntPtr collisionShape);
1301
1302[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1303public static extern void DumpMapInfo2(IntPtr sim, IntPtr manInfo);
1304
1305[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1306public static extern void DumpConstraint2(IntPtr sim, IntPtr constrain);
1307
1308[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1309public static extern void DumpActivationInfo2(IntPtr sim);
1310
1311[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1312public static extern void DumpAllInfo2(IntPtr sim);
1313
1314[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
1315public static extern void DumpPhysicsStatistics2(IntPtr sim);
1316
1317}
1318}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index d5ab245..328164b 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -137,7 +137,7 @@ public sealed class BSCharacter : BSPhysObject
137 137
138 private void SetPhysicalProperties() 138 private void SetPhysicalProperties()
139 { 139 {
140 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 140 PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody);
141 141
142 ZeroMotion(true); 142 ZeroMotion(true);
143 ForcePosition = _position; 143 ForcePosition = _position;
@@ -152,14 +152,14 @@ public sealed class BSCharacter : BSPhysObject
152 // Needs to be reset especially when an avatar is recreated after crossing a region boundry. 152 // Needs to be reset especially when an avatar is recreated after crossing a region boundry.
153 Flying = _flying; 153 Flying = _flying;
154 154
155 BulletSimAPI.SetRestitution2(PhysBody.ptr, BSParam.AvatarRestitution); 155 PhysicsScene.PE.SetRestitution(PhysBody, BSParam.AvatarRestitution);
156 BulletSimAPI.SetMargin2(PhysShape.ptr, PhysicsScene.Params.collisionMargin); 156 BulletSimAPI.SetMargin2(PhysShape.ptr, PhysicsScene.Params.collisionMargin);
157 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); 157 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
158 BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, BSParam.ContactProcessingThreshold); 158 PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
159 if (BSParam.CcdMotionThreshold > 0f) 159 if (BSParam.CcdMotionThreshold > 0f)
160 { 160 {
161 BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, BSParam.CcdMotionThreshold); 161 PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
162 BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, BSParam.CcdSweptSphereRadius); 162 PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
163 } 163 }
164 164
165 UpdatePhysicalMassProperties(RawMass, false); 165 UpdatePhysicalMassProperties(RawMass, false);
@@ -167,13 +167,13 @@ public sealed class BSCharacter : BSPhysObject
167 // Make so capsule does not fall over 167 // Make so capsule does not fall over
168 BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero); 168 BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero);
169 169
170 BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT); 170 PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_CHARACTER_OBJECT);
171 171
172 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 172 PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, PhysBody);
173 173
174 // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); 174 // PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG);
175 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_DEACTIVATION); 175 PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_DEACTIVATION);
176 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); 176 PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, PhysBody);
177 177
178 // Do this after the object has been added to the world 178 // Do this after the object has been added to the world
179 PhysBody.collisionType = CollisionType.Avatar; 179 PhysBody.collisionType = CollisionType.Avatar;
@@ -320,7 +320,7 @@ public sealed class BSCharacter : BSPhysObject
320 { 320 {
321 if (PhysBody.HasPhysicalBody) 321 if (PhysBody.HasPhysicalBody)
322 { 322 {
323 BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero); 323 PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, OMV.Vector3.Zero);
324 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero); 324 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero);
325 // The next also get rid of applied linear force but the linear velocity is untouched. 325 // The next also get rid of applied linear force but the linear velocity is untouched.
326 BulletSimAPI.ClearForces2(PhysBody.ptr); 326 BulletSimAPI.ClearForces2(PhysBody.ptr);
@@ -350,19 +350,19 @@ public sealed class BSCharacter : BSPhysObject
350 { 350 {
351 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 351 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
352 if (PhysBody.HasPhysicalBody) 352 if (PhysBody.HasPhysicalBody)
353 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 353 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
354 }); 354 });
355 } 355 }
356 } 356 }
357 public override OMV.Vector3 ForcePosition { 357 public override OMV.Vector3 ForcePosition {
358 get { 358 get {
359 _position = BulletSimAPI.GetPosition2(PhysBody.ptr); 359 _position = PhysicsScene.PE.GetPosition(PhysBody);
360 return _position; 360 return _position;
361 } 361 }
362 set { 362 set {
363 _position = value; 363 _position = value;
364 PositionSanityCheck(); 364 PositionSanityCheck();
365 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 365 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
366 } 366 }
367 } 367 }
368 368
@@ -418,7 +418,7 @@ public sealed class BSCharacter : BSPhysObject
418 { 418 {
419 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); 419 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation);
420 if (PhysBody.HasPhysicalBody) 420 if (PhysBody.HasPhysicalBody)
421 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 421 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
422 }); 422 });
423 ret = true; 423 ret = true;
424 } 424 }
@@ -520,7 +520,7 @@ public sealed class BSCharacter : BSPhysObject
520 { 520 {
521 _currentFriction = BSParam.AvatarStandingFriction; 521 _currentFriction = BSParam.AvatarStandingFriction;
522 if (PhysBody.HasPhysicalBody) 522 if (PhysBody.HasPhysicalBody)
523 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction); 523 PhysicsScene.PE.SetFriction(PhysBody, _currentFriction);
524 } 524 }
525 } 525 }
526 else 526 else
@@ -529,12 +529,12 @@ public sealed class BSCharacter : BSPhysObject
529 { 529 {
530 _currentFriction = BSParam.AvatarFriction; 530 _currentFriction = BSParam.AvatarFriction;
531 if (PhysBody.HasPhysicalBody) 531 if (PhysBody.HasPhysicalBody)
532 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction); 532 PhysicsScene.PE.SetFriction(PhysBody, _currentFriction);
533 } 533 }
534 } 534 }
535 535
536 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity); 536 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity);
537 BulletSimAPI.Activate2(PhysBody.ptr, true); 537 PhysicsScene.PE.Activate(PhysBody, true);
538 } 538 }
539 } 539 }
540 public override OMV.Vector3 Torque { 540 public override OMV.Vector3 Torque {
@@ -576,7 +576,7 @@ public sealed class BSCharacter : BSPhysObject
576 { 576 {
577 get 577 get
578 { 578 {
579 _orientation = BulletSimAPI.GetOrientation2(PhysBody.ptr); 579 _orientation = PhysicsScene.PE.GetOrientation(PhysBody);
580 return _orientation; 580 return _orientation;
581 } 581 }
582 set 582 set
@@ -584,8 +584,8 @@ public sealed class BSCharacter : BSPhysObject
584 _orientation = value; 584 _orientation = value;
585 if (PhysBody.HasPhysicalBody) 585 if (PhysBody.HasPhysicalBody)
586 { 586 {
587 // _position = BulletSimAPI.GetPosition2(BSBody.ptr); 587 // _position = PhysicsScene.PE.GetPosition(BSBody);
588 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 588 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
589 } 589 }
590 } 590 }
591 } 591 }
@@ -636,9 +636,9 @@ public sealed class BSCharacter : BSPhysObject
636 if (PhysBody.HasPhysicalBody) 636 if (PhysBody.HasPhysicalBody)
637 { 637 {
638 if (_floatOnWater) 638 if (_floatOnWater)
639 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 639 CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
640 else 640 else
641 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 641 CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
642 } 642 }
643 }); 643 });
644 } 644 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs
index 59584b2..c9c7c2e 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs
@@ -37,6 +37,7 @@ public abstract class BSConstraint : IDisposable
37 private static string LogHeader = "[BULLETSIM CONSTRAINT]"; 37 private static string LogHeader = "[BULLETSIM CONSTRAINT]";
38 38
39 protected BulletWorld m_world; 39 protected BulletWorld m_world;
40 protected BSScene PhysicsScene;
40 protected BulletBody m_body1; 41 protected BulletBody m_body1;
41 protected BulletBody m_body2; 42 protected BulletBody m_body2;
42 protected BulletConstraint m_constraint; 43 protected BulletConstraint m_constraint;
@@ -48,8 +49,10 @@ public abstract class BSConstraint : IDisposable
48 public abstract ConstraintType Type { get; } 49 public abstract ConstraintType Type { get; }
49 public bool IsEnabled { get { return m_enabled; } } 50 public bool IsEnabled { get { return m_enabled; } }
50 51
51 public BSConstraint() 52 public BSConstraint(BulletWorld world)
52 { 53 {
54 m_world = world;
55 PhysicsScene = m_world.physicsScene;
53 } 56 }
54 57
55 public virtual void Dispose() 58 public virtual void Dispose()
@@ -59,7 +62,7 @@ public abstract class BSConstraint : IDisposable
59 m_enabled = false; 62 m_enabled = false;
60 if (m_constraint.HasPhysicalConstraint) 63 if (m_constraint.HasPhysicalConstraint)
61 { 64 {
62 bool success = BulletSimAPI.DestroyConstraint2(m_world.ptr, m_constraint.ptr); 65 bool success = PhysicsScene.PE.DestroyConstraint(m_world, m_constraint);
63 m_world.physicsScene.DetailLog("{0},BSConstraint.Dispose,taint,id1={1},body1={2},id2={3},body2={4},success={5}", 66 m_world.physicsScene.DetailLog("{0},BSConstraint.Dispose,taint,id1={1},body1={2},id2={3},body2={4},success={5}",
64 BSScene.DetailLogZero, 67 BSScene.DetailLogZero,
65 m_body1.ID, m_body1.ptr.ToString("X"), 68 m_body1.ID, m_body1.ptr.ToString("X"),
@@ -74,7 +77,7 @@ public abstract class BSConstraint : IDisposable
74 { 77 {
75 bool ret = false; 78 bool ret = false;
76 if (m_enabled) 79 if (m_enabled)
77 ret = BulletSimAPI.SetLinearLimits2(m_constraint.ptr, low, high); 80 ret = PhysicsScene.PE.SetLinearLimits(m_constraint, low, high);
78 return ret; 81 return ret;
79 } 82 }
80 83
@@ -82,7 +85,7 @@ public abstract class BSConstraint : IDisposable
82 { 85 {
83 bool ret = false; 86 bool ret = false;
84 if (m_enabled) 87 if (m_enabled)
85 ret = BulletSimAPI.SetAngularLimits2(m_constraint.ptr, low, high); 88 ret = PhysicsScene.PE.SetAngularLimits(m_constraint, low, high);
86 return ret; 89 return ret;
87 } 90 }
88 91
@@ -91,7 +94,7 @@ public abstract class BSConstraint : IDisposable
91 bool ret = false; 94 bool ret = false;
92 if (m_enabled) 95 if (m_enabled)
93 { 96 {
94 BulletSimAPI.SetConstraintNumSolverIterations2(m_constraint.ptr, cnt); 97 PhysicsScene.PE.SetConstraintNumSolverIterations(m_constraint, cnt);
95 ret = true; 98 ret = true;
96 } 99 }
97 return ret; 100 return ret;
@@ -103,7 +106,7 @@ public abstract class BSConstraint : IDisposable
103 if (m_enabled) 106 if (m_enabled)
104 { 107 {
105 // Recompute the internal transforms 108 // Recompute the internal transforms
106 BulletSimAPI.CalculateTransforms2(m_constraint.ptr); 109 PhysicsScene.PE.CalculateTransforms(m_constraint);
107 ret = true; 110 ret = true;
108 } 111 }
109 return ret; 112 return ret;
@@ -122,7 +125,7 @@ public abstract class BSConstraint : IDisposable
122 // Setting an object's mass to zero (making it static like when it's selected) 125 // Setting an object's mass to zero (making it static like when it's selected)
123 // automatically disables the constraints. 126 // automatically disables the constraints.
124 // If the link is enabled, be sure to set the constraint itself to enabled. 127 // If the link is enabled, be sure to set the constraint itself to enabled.
125 BulletSimAPI.SetConstraintEnable2(m_constraint.ptr, BSParam.NumericBool(true)); 128 PhysicsScene.PE.SetConstraintEnable(m_constraint, BSParam.NumericBool(true));
126 } 129 }
127 else 130 else
128 { 131 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs
index b946870..aee93c9 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs
@@ -43,15 +43,14 @@ public sealed class BSConstraint6Dof : BSConstraint
43 Vector3 frame1, Quaternion frame1rot, 43 Vector3 frame1, Quaternion frame1rot,
44 Vector3 frame2, Quaternion frame2rot, 44 Vector3 frame2, Quaternion frame2rot,
45 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) 45 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
46 : base(world)
46 { 47 {
47 m_world = world;
48 m_body1 = obj1; 48 m_body1 = obj1;
49 m_body2 = obj2; 49 m_body2 = obj2;
50 m_constraint = new BulletConstraint( 50 m_constraint = PhysicsScene.PE.Create6DofConstraint(m_world, m_body1, m_body2,
51 BulletSimAPI.Create6DofConstraint2(m_world.ptr, m_body1.ptr, m_body2.ptr,
52 frame1, frame1rot, 51 frame1, frame1rot,
53 frame2, frame2rot, 52 frame2, frame2rot,
54 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); 53 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
55 m_enabled = true; 54 m_enabled = true;
56 world.physicsScene.DetailLog("{0},BS6DofConstraint,createFrame,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", 55 world.physicsScene.DetailLog("{0},BS6DofConstraint,createFrame,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}",
57 BSScene.DetailLogZero, world.worldID, 56 BSScene.DetailLogZero, world.worldID,
@@ -61,8 +60,8 @@ public sealed class BSConstraint6Dof : BSConstraint
61 public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2, 60 public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2,
62 Vector3 joinPoint, 61 Vector3 joinPoint,
63 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) 62 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
63 : base(world)
64 { 64 {
65 m_world = world;
66 m_body1 = obj1; 65 m_body1 = obj1;
67 m_body2 = obj2; 66 m_body2 = obj2;
68 if (!obj1.HasPhysicalBody || !obj2.HasPhysicalBody) 67 if (!obj1.HasPhysicalBody || !obj2.HasPhysicalBody)
@@ -76,11 +75,10 @@ public sealed class BSConstraint6Dof : BSConstraint
76 } 75 }
77 else 76 else
78 { 77 {
79 m_constraint = new BulletConstraint( 78 m_constraint = PhysicsScene.PE.Create6DofConstraintToPoint(m_world, m_body1, m_body2,
80 BulletSimAPI.Create6DofConstraintToPoint2(m_world.ptr, m_body1.ptr, m_body2.ptr,
81 joinPoint, 79 joinPoint,
82 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies)); 80 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
83 world.physicsScene.DetailLog("{0},BS6DofConstraint,createMidPoint,wID={1}, csrt={2}, rID={3}, rBody={4}, cID={5}, cBody={6}", 81 PhysicsScene.DetailLog("{0},BS6DofConstraint,createMidPoint,wID={1}, csrt={2}, rID={3}, rBody={4}, cID={5}, cBody={6}",
84 BSScene.DetailLogZero, world.worldID, m_constraint.ptr.ToString("X"), 82 BSScene.DetailLogZero, world.worldID, m_constraint.ptr.ToString("X"),
85 obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X")); 83 obj1.ID, obj1.ptr.ToString("X"), obj2.ID, obj2.ptr.ToString("X"));
86 if (!m_constraint.HasPhysicalConstraint) 84 if (!m_constraint.HasPhysicalConstraint)
@@ -101,7 +99,7 @@ public sealed class BSConstraint6Dof : BSConstraint
101 bool ret = false; 99 bool ret = false;
102 if (m_enabled) 100 if (m_enabled)
103 { 101 {
104 BulletSimAPI.SetFrames2(m_constraint.ptr, frameA, frameArot, frameB, frameBrot); 102 PhysicsScene.PE.SetFrames(m_constraint, frameA, frameArot, frameB, frameBrot);
105 ret = true; 103 ret = true;
106 } 104 }
107 return ret; 105 return ret;
@@ -112,9 +110,9 @@ public sealed class BSConstraint6Dof : BSConstraint
112 bool ret = false; 110 bool ret = false;
113 if (m_enabled) 111 if (m_enabled)
114 { 112 {
115 BulletSimAPI.SetConstraintParam2(m_constraint.ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL); 113 PhysicsScene.PE.SetConstraintParam(m_constraint, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL);
116 BulletSimAPI.SetConstraintParam2(m_constraint.ptr, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL); 114 PhysicsScene.PE.SetConstraintParam(m_constraint, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL);
117 BulletSimAPI.SetConstraintParam2(m_constraint.ptr, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL); 115 PhysicsScene.PE.SetConstraintParam(m_constraint, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL);
118 ret = true; 116 ret = true;
119 } 117 }
120 return ret; 118 return ret;
@@ -125,7 +123,7 @@ public sealed class BSConstraint6Dof : BSConstraint
125 bool ret = false; 123 bool ret = false;
126 float onOff = useOffset ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse; 124 float onOff = useOffset ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse;
127 if (m_enabled) 125 if (m_enabled)
128 ret = BulletSimAPI.UseFrameOffset2(m_constraint.ptr, onOff); 126 ret = PhysicsScene.PE.UseFrameOffset(m_constraint, onOff);
129 return ret; 127 return ret;
130 } 128 }
131 129
@@ -135,7 +133,7 @@ public sealed class BSConstraint6Dof : BSConstraint
135 float onOff = enable ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse; 133 float onOff = enable ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse;
136 if (m_enabled) 134 if (m_enabled)
137 { 135 {
138 ret = BulletSimAPI.TranslationalLimitMotor2(m_constraint.ptr, onOff, targetVelocity, maxMotorForce); 136 ret = PhysicsScene.PE.TranslationalLimitMotor(m_constraint, onOff, targetVelocity, maxMotorForce);
139 m_world.physicsScene.DetailLog("{0},BS6DOFConstraint,TransLimitMotor,enable={1},vel={2},maxForce={3}", 137 m_world.physicsScene.DetailLog("{0},BS6DOFConstraint,TransLimitMotor,enable={1},vel={2},maxForce={3}",
140 BSScene.DetailLogZero, enable, targetVelocity, maxMotorForce); 138 BSScene.DetailLogZero, enable, targetVelocity, maxMotorForce);
141 } 139 }
@@ -146,7 +144,7 @@ public sealed class BSConstraint6Dof : BSConstraint
146 { 144 {
147 bool ret = false; 145 bool ret = false;
148 if (m_enabled) 146 if (m_enabled)
149 ret = BulletSimAPI.SetBreakingImpulseThreshold2(m_constraint.ptr, threshold); 147 ret = PhysicsScene.PE.SetBreakingImpulseThreshold(m_constraint, threshold);
150 return ret; 148 return ret;
151 } 149 }
152} 150}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs
index a5378b9..7714a03 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs
@@ -40,15 +40,13 @@ public sealed class BSConstraintHinge : BSConstraint
40 Vector3 pivotInA, Vector3 pivotInB, 40 Vector3 pivotInA, Vector3 pivotInB,
41 Vector3 axisInA, Vector3 axisInB, 41 Vector3 axisInA, Vector3 axisInB,
42 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) 42 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
43 : base(world)
43 { 44 {
44 m_world = world;
45 m_body1 = obj1; 45 m_body1 = obj1;
46 m_body2 = obj2; 46 m_body2 = obj2;
47 m_constraint = new BulletConstraint( 47 m_constraint = PhysicsScene.PE.CreateHingeConstraint(world, obj1, obj2,
48 BulletSimAPI.CreateHingeConstraint2(m_world.ptr, m_body1.ptr, m_body2.ptr, 48 pivotInA, pivotInB, axisInA, axisInB,
49 pivotInA, pivotInB, 49 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
50 axisInA, axisInB,
51 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies));
52 m_enabled = true; 50 m_enabled = true;
53 } 51 }
54 52
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 0bdfbe3..5d70ef7 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -558,7 +558,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
558 558
559 // Friction affects are handled by this vehicle code 559 // Friction affects are handled by this vehicle code
560 float friction = 0f; 560 float friction = 0f;
561 BulletSimAPI.SetFriction2(Prim.PhysBody.ptr, friction); 561 PhysicsScene.PE.SetFriction(Prim.PhysBody, friction);
562 562
563 // Moderate angular movement introduced by Bullet. 563 // Moderate angular movement introduced by Bullet.
564 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. 564 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle.
@@ -567,7 +567,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
567 BulletSimAPI.SetAngularDamping2(Prim.PhysBody.ptr, angularDamping); 567 BulletSimAPI.SetAngularDamping2(Prim.PhysBody.ptr, angularDamping);
568 568
569 // Vehicles report collision events so we know when it's on the ground 569 // Vehicles report collision events so we know when it's on the ground
570 BulletSimAPI.AddToCollisionFlags2(Prim.PhysBody.ptr, CollisionFlags.BS_VEHICLE_COLLISIONS); 570 PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
571 571
572 Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(Prim.PhysShape.ptr, m_vehicleMass); 572 Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(Prim.PhysShape.ptr, m_vehicleMass);
573 BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia); 573 BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia);
@@ -581,7 +581,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
581 } 581 }
582 else 582 else
583 { 583 {
584 BulletSimAPI.RemoveFromCollisionFlags2(Prim.PhysBody.ptr, CollisionFlags.BS_VEHICLE_COLLISIONS); 584 PhysicsScene.PE.RemoveFromCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
585 } 585 }
586 } 586 }
587 587
@@ -651,7 +651,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
651 if ((m_knownChanged & m_knownChangedVelocity) != 0) 651 if ((m_knownChanged & m_knownChangedVelocity) != 0)
652 { 652 {
653 Prim.ForceVelocity = m_knownVelocity; 653 Prim.ForceVelocity = m_knownVelocity;
654 BulletSimAPI.SetInterpolationLinearVelocity2(Prim.PhysBody.ptr, VehicleVelocity); 654 PhysicsScene.PE.SetInterpolationLinearVelocity(Prim.PhysBody, VehicleVelocity);
655 } 655 }
656 656
657 if ((m_knownChanged & m_knownChangedForce) != 0) 657 if ((m_knownChanged & m_knownChangedForce) != 0)
@@ -661,7 +661,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
661 { 661 {
662 Prim.ForceRotationalVelocity = m_knownRotationalVelocity; 662 Prim.ForceRotationalVelocity = m_knownRotationalVelocity;
663 // Fake out Bullet by making it think the velocity is the same as last time. 663 // Fake out Bullet by making it think the velocity is the same as last time.
664 BulletSimAPI.SetInterpolationAngularVelocity2(Prim.PhysBody.ptr, m_knownRotationalVelocity); 664 PhysicsScene.PE.SetInterpolationAngularVelocity(Prim.PhysBody, m_knownRotationalVelocity);
665 } 665 }
666 666
667 if ((m_knownChanged & m_knownChangedRotationalForce) != 0) 667 if ((m_knownChanged & m_knownChangedRotationalForce) != 0)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 9bb951c..3c99ca7 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -131,10 +131,10 @@ public sealed class BSLinksetCompound : BSLinkset
131 { 131 {
132 // The origional prims are removed from the world as the shape of the root compound 132 // The origional prims are removed from the world as the shape of the root compound
133 // shape takes over. 133 // shape takes over.
134 BulletSimAPI.AddToCollisionFlags2(child.PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 134 PhysicsScene.PE.AddToCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
135 BulletSimAPI.ForceActivationState2(child.PhysBody.ptr, ActivationState.DISABLE_SIMULATION); 135 PhysicsScene.PE.ForceActivationState(child.PhysBody, ActivationState.DISABLE_SIMULATION);
136 // We don't want collisions from the old linkset children. 136 // We don't want collisions from the old linkset children.
137 BulletSimAPI.RemoveFromCollisionFlags2(child.PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 137 PhysicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
138 138
139 child.PhysBody.collisionType = CollisionType.LinksetChild; 139 child.PhysBody.collisionType = CollisionType.LinksetChild;
140 140
@@ -159,12 +159,12 @@ public sealed class BSLinksetCompound : BSLinkset
159 else 159 else
160 { 160 {
161 // The non-physical children can come back to life. 161 // The non-physical children can come back to life.
162 BulletSimAPI.RemoveFromCollisionFlags2(child.PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 162 PhysicsScene.PE.RemoveFromCollisionFlags(child.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
163 163
164 child.PhysBody.collisionType = CollisionType.LinksetChild; 164 child.PhysBody.collisionType = CollisionType.LinksetChild;
165 165
166 // Don't force activation so setting of DISABLE_SIMULATION can stay if used. 166 // Don't force activation so setting of DISABLE_SIMULATION can stay if used.
167 BulletSimAPI.Activate2(child.PhysBody.ptr, false); 167 PhysicsScene.PE.Activate(child.PhysBody, false);
168 ret = true; 168 ret = true;
169 } 169 }
170 return ret; 170 return ret;
@@ -371,7 +371,7 @@ public sealed class BSLinksetCompound : BSLinkset
371 PhysicsScene.Logger.ErrorFormat("{0} Rebuilt sharable shape when building linkset! Region={1}, primID={2}, shape={3}", 371 PhysicsScene.Logger.ErrorFormat("{0} Rebuilt sharable shape when building linkset! Region={1}, primID={2}, shape={3}",
372 LogHeader, PhysicsScene.RegionName, cPrim.LocalID, cPrim.PhysShape); 372 LogHeader, PhysicsScene.RegionName, cPrim.LocalID, cPrim.PhysShape);
373 } 373 }
374 PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetRoot.PhysShape, cPrim.PhysShape, lci.OffsetPos, lci.OffsetRot); 374 PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetRoot.PhysShape, cPrim.PhysShape, lci.OffsetPos, lci.OffsetRot);
375 } 375 }
376 } 376 }
377 return false; // 'false' says to move onto the next child in the list 377 return false; // 'false' says to move onto the next child in the list
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 5c8553a..c6c2946 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -300,7 +300,7 @@ public static class BSParam
300 (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, 300 (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); },
301 (s) => { return DeactivationTime; }, 301 (s) => { return DeactivationTime; },
302 (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, 302 (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); },
303 (s,o,v) => { BulletSimAPI.SetDeactivationTime2(o.PhysBody.ptr, v); } ), 303 (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ),
304 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", 304 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static",
305 0.8f, 305 0.8f,
306 (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, 306 (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); },
@@ -318,19 +318,19 @@ public static class BSParam
318 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, 318 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); },
319 (s) => { return CcdMotionThreshold; }, 319 (s) => { return CcdMotionThreshold; },
320 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, 320 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); },
321 (s,o,v) => { BulletSimAPI.SetCcdMotionThreshold2(o.PhysBody.ptr, v); } ), 321 (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ),
322 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , 322 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" ,
323 0f, 323 0f,
324 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, 324 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); },
325 (s) => { return CcdSweptSphereRadius; }, 325 (s) => { return CcdSweptSphereRadius; },
326 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, 326 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); },
327 (s,o,v) => { BulletSimAPI.SetCcdSweptSphereRadius2(o.PhysBody.ptr, v); } ), 327 (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ),
328 new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , 328 new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" ,
329 0.1f, 329 0.1f,
330 (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, 330 (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); },
331 (s) => { return ContactProcessingThreshold; }, 331 (s) => { return ContactProcessingThreshold; },
332 (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, 332 (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); },
333 (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.PhysBody.ptr, v); } ), 333 (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ),
334 334
335 new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", 335 new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
336 (float)BSTerrainPhys.TerrainImplementation.Mesh, 336 (float)BSTerrainPhys.TerrainImplementation.Mesh,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index b093890..e7cb3e0 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -308,7 +308,7 @@ public abstract class BSPhysObject : PhysicsActor
308 PhysicsScene.TaintedObject(TypeName+".SubscribeEvents", delegate() 308 PhysicsScene.TaintedObject(TypeName+".SubscribeEvents", delegate()
309 { 309 {
310 if (PhysBody.HasPhysicalBody) 310 if (PhysBody.HasPhysicalBody)
311 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 311 CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
312 }); 312 });
313 } 313 }
314 else 314 else
@@ -324,7 +324,7 @@ public abstract class BSPhysObject : PhysicsActor
324 { 324 {
325 // Make sure there is a body there because sometimes destruction happens in an un-ideal order. 325 // Make sure there is a body there because sometimes destruction happens in an un-ideal order.
326 if (PhysBody.HasPhysicalBody) 326 if (PhysBody.HasPhysicalBody)
327 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 327 CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
328 }); 328 });
329 } 329 }
330 // Return 'true' if the simulator wants collision events 330 // Return 'true' if the simulator wants collision events
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index cf09be2..613606f 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -120,7 +120,7 @@ public sealed class BSPrim : BSPhysObject
120 { 120 {
121 CreateGeomAndObject(true); 121 CreateGeomAndObject(true);
122 122
123 CurrentCollisionFlags = BulletSimAPI.GetCollisionFlags2(PhysBody.ptr); 123 CurrentCollisionFlags = PhysicsScene.PE.GetCollisionFlags(PhysBody);
124 }); 124 });
125 } 125 }
126 126
@@ -265,7 +265,7 @@ public sealed class BSPrim : BSPhysObject
265 // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity); 265 // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity);
266 if (PhysBody.HasPhysicalBody) 266 if (PhysBody.HasPhysicalBody)
267 { 267 {
268 BulletSimAPI.SetInterpolationAngularVelocity2(PhysBody.ptr, _rotationalVelocity); 268 PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity);
269 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity); 269 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
270 } 270 }
271 }); 271 });
@@ -318,14 +318,14 @@ public sealed class BSPrim : BSPhysObject
318 } 318 }
319 public override OMV.Vector3 ForcePosition { 319 public override OMV.Vector3 ForcePosition {
320 get { 320 get {
321 _position = BulletSimAPI.GetPosition2(PhysBody.ptr); 321 _position = PhysicsScene.PE.GetPosition(PhysBody);
322 return _position; 322 return _position;
323 } 323 }
324 set { 324 set {
325 _position = value; 325 _position = value;
326 if (PhysBody.HasPhysicalBody) 326 if (PhysBody.HasPhysicalBody)
327 { 327 {
328 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 328 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
329 ActivateIfPhysical(false); 329 ActivateIfPhysical(false);
330 } 330 }
331 } 331 }
@@ -419,7 +419,7 @@ public sealed class BSPrim : BSPhysObject
419 // Changing interesting properties doesn't change proxy and collision cache 419 // Changing interesting properties doesn't change proxy and collision cache
420 // information. The Bullet solution is to re-add the object to the world 420 // information. The Bullet solution is to re-add the object to the world
421 // after parameters are changed. 421 // after parameters are changed.
422 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 422 PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody);
423 } 423 }
424 424
425 // The computation of mass props requires gravity to be set on the object. 425 // The computation of mass props requires gravity to be set on the object.
@@ -649,9 +649,9 @@ public sealed class BSPrim : BSPhysObject
649 { 649 {
650 if (PhysBody.HasPhysicalBody) 650 if (PhysBody.HasPhysicalBody)
651 { 651 {
652 // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); 652 // _position = PhysicsScene.PE.GetObjectPosition(PhysicsScene.World, BSBody);
653 // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); 653 // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation);
654 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 654 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
655 } 655 }
656 }); 656 });
657 } 657 }
@@ -661,13 +661,13 @@ public sealed class BSPrim : BSPhysObject
661 { 661 {
662 get 662 get
663 { 663 {
664 _orientation = BulletSimAPI.GetOrientation2(PhysBody.ptr); 664 _orientation = PhysicsScene.PE.GetOrientation(PhysBody);
665 return _orientation; 665 return _orientation;
666 } 666 }
667 set 667 set
668 { 668 {
669 _orientation = value; 669 _orientation = value;
670 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 670 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
671 } 671 }
672 } 672 }
673 public override int PhysicsActorType { 673 public override int PhysicsActorType {
@@ -723,7 +723,7 @@ public sealed class BSPrim : BSPhysObject
723 723
724 // Mangling all the physical properties requires the object not be in the physical world. 724 // Mangling all the physical properties requires the object not be in the physical world.
725 // This is a NOOP if the object is not in the world (BulletSim and Bullet ignore objects not found). 725 // This is a NOOP if the object is not in the world (BulletSim and Bullet ignore objects not found).
726 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 726 PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody);
727 727
728 // Set up the object physicalness (does gravity and collisions move this object) 728 // Set up the object physicalness (does gravity and collisions move this object)
729 MakeDynamic(IsStatic); 729 MakeDynamic(IsStatic);
@@ -740,7 +740,7 @@ public sealed class BSPrim : BSPhysObject
740 AddObjectToPhysicalWorld(); 740 AddObjectToPhysicalWorld();
741 741
742 // Rebuild its shape 742 // Rebuild its shape
743 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr); 743 PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, PhysBody);
744 744
745 // Recompute any linkset parameters. 745 // Recompute any linkset parameters.
746 // When going from non-physical to physical, this re-enables the constraints that 746 // When going from non-physical to physical, this re-enables the constraints that
@@ -762,28 +762,28 @@ public sealed class BSPrim : BSPhysObject
762 if (makeStatic) 762 if (makeStatic)
763 { 763 {
764 // Become a Bullet 'static' object type 764 // Become a Bullet 'static' object type
765 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT); 765 CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_STATIC_OBJECT);
766 // Stop all movement 766 // Stop all movement
767 ZeroMotion(true); 767 ZeroMotion(true);
768 768
769 // Set various physical properties so other object interact properly 769 // Set various physical properties so other object interact properly
770 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false); 770 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false);
771 BulletSimAPI.SetFriction2(PhysBody.ptr, matAttrib.friction); 771 PhysicsScene.PE.SetFriction(PhysBody, matAttrib.friction);
772 BulletSimAPI.SetRestitution2(PhysBody.ptr, matAttrib.restitution); 772 PhysicsScene.PE.SetRestitution(PhysBody, matAttrib.restitution);
773 773
774 // Mass is zero which disables a bunch of physics stuff in Bullet 774 // Mass is zero which disables a bunch of physics stuff in Bullet
775 UpdatePhysicalMassProperties(0f, false); 775 UpdatePhysicalMassProperties(0f, false);
776 // Set collision detection parameters 776 // Set collision detection parameters
777 if (BSParam.CcdMotionThreshold > 0f) 777 if (BSParam.CcdMotionThreshold > 0f)
778 { 778 {
779 BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, BSParam.CcdMotionThreshold); 779 PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
780 BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, BSParam.CcdSweptSphereRadius); 780 PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
781 } 781 }
782 782
783 // The activation state is 'disabled' so Bullet will not try to act on it. 783 // The activation state is 'disabled' so Bullet will not try to act on it.
784 // BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_SIMULATION); 784 // PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_SIMULATION);
785 // Start it out sleeping and physical actions could wake it up. 785 // Start it out sleeping and physical actions could wake it up.
786 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ISLAND_SLEEPING); 786 PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ISLAND_SLEEPING);
787 787
788 // This collides like a static object 788 // This collides like a static object
789 PhysBody.collisionType = CollisionType.Static; 789 PhysBody.collisionType = CollisionType.Static;
@@ -794,22 +794,22 @@ public sealed class BSPrim : BSPhysObject
794 else 794 else
795 { 795 {
796 // Not a Bullet static object 796 // Not a Bullet static object
797 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT); 797 CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.CF_STATIC_OBJECT);
798 798
799 // Set various physical properties so other object interact properly 799 // Set various physical properties so other object interact properly
800 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, true); 800 MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, true);
801 BulletSimAPI.SetFriction2(PhysBody.ptr, matAttrib.friction); 801 PhysicsScene.PE.SetFriction(PhysBody, matAttrib.friction);
802 BulletSimAPI.SetRestitution2(PhysBody.ptr, matAttrib.restitution); 802 PhysicsScene.PE.SetRestitution(PhysBody, matAttrib.restitution);
803 803
804 // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382 804 // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382
805 // Since this can be called multiple times, only zero forces when becoming physical 805 // Since this can be called multiple times, only zero forces when becoming physical
806 // BulletSimAPI.ClearAllForces2(BSBody.ptr); 806 // PhysicsScene.PE.ClearAllForces(BSBody);
807 807
808 // For good measure, make sure the transform is set through to the motion state 808 // For good measure, make sure the transform is set through to the motion state
809 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation); 809 PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation);
810 810
811 // Center of mass is at the center of the object 811 // Center of mass is at the center of the object
812 // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody.ptr, _position, _orientation); 812 // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody, _position, _orientation);
813 813
814 // A dynamic object has mass 814 // A dynamic object has mass
815 UpdatePhysicalMassProperties(RawMass, false); 815 UpdatePhysicalMassProperties(RawMass, false);
@@ -817,22 +817,22 @@ public sealed class BSPrim : BSPhysObject
817 // Set collision detection parameters 817 // Set collision detection parameters
818 if (BSParam.CcdMotionThreshold > 0f) 818 if (BSParam.CcdMotionThreshold > 0f)
819 { 819 {
820 BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, BSParam.CcdMotionThreshold); 820 PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
821 BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, BSParam.CcdSweptSphereRadius); 821 PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
822 } 822 }
823 823
824 // Various values for simulation limits 824 // Various values for simulation limits
825 BulletSimAPI.SetDamping2(PhysBody.ptr, BSParam.LinearDamping, BSParam.AngularDamping); 825 BulletSimAPI.SetDamping2(PhysBody.ptr, BSParam.LinearDamping, BSParam.AngularDamping);
826 BulletSimAPI.SetDeactivationTime2(PhysBody.ptr, BSParam.DeactivationTime); 826 PhysicsScene.PE.SetDeactivationTime(PhysBody, BSParam.DeactivationTime);
827 BulletSimAPI.SetSleepingThresholds2(PhysBody.ptr, BSParam.LinearSleepingThreshold, BSParam.AngularSleepingThreshold); 827 BulletSimAPI.SetSleepingThresholds2(PhysBody.ptr, BSParam.LinearSleepingThreshold, BSParam.AngularSleepingThreshold);
828 BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, BSParam.ContactProcessingThreshold); 828 PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
829 829
830 // This collides like an object. 830 // This collides like an object.
831 PhysBody.collisionType = CollisionType.Dynamic; 831 PhysBody.collisionType = CollisionType.Dynamic;
832 832
833 // Force activation of the object so Bullet will act on it. 833 // Force activation of the object so Bullet will act on it.
834 // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects. 834 // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects.
835 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ACTIVE_TAG); 835 PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG);
836 836
837 // There might be special things needed for implementing linksets. 837 // There might be special things needed for implementing linksets.
838 Linkset.MakeDynamic(this); 838 Linkset.MakeDynamic(this);
@@ -853,7 +853,7 @@ public sealed class BSPrim : BSPhysObject
853 { 853 {
854 m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for solidity. id={1}, type={2}", LogHeader, LocalID, bodyType); 854 m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for solidity. id={1}, type={2}", LogHeader, LocalID, bodyType);
855 } 855 }
856 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 856 CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
857 } 857 }
858 else 858 else
859 { 859 {
@@ -861,7 +861,7 @@ public sealed class BSPrim : BSPhysObject
861 { 861 {
862 m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); 862 m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType);
863 } 863 }
864 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 864 CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
865 865
866 // Change collision info from a static object to a ghosty collision object 866 // Change collision info from a static object to a ghosty collision object
867 PhysBody.collisionType = CollisionType.VolumeDetect; 867 PhysBody.collisionType = CollisionType.VolumeDetect;
@@ -874,7 +874,7 @@ public sealed class BSPrim : BSPhysObject
874 private void ActivateIfPhysical(bool forceIt) 874 private void ActivateIfPhysical(bool forceIt)
875 { 875 {
876 if (IsPhysical && PhysBody.HasPhysicalBody) 876 if (IsPhysical && PhysBody.HasPhysicalBody)
877 BulletSimAPI.Activate2(PhysBody.ptr, forceIt); 877 PhysicsScene.PE.Activate(PhysBody, forceIt);
878 } 878 }
879 879
880 // Turn on or off the flag controlling whether collision events are returned to the simulator. 880 // Turn on or off the flag controlling whether collision events are returned to the simulator.
@@ -882,11 +882,11 @@ public sealed class BSPrim : BSPhysObject
882 { 882 {
883 if (wantsCollisionEvents) 883 if (wantsCollisionEvents)
884 { 884 {
885 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 885 CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
886 } 886 }
887 else 887 else
888 { 888 {
889 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 889 CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
890 } 890 }
891 } 891 }
892 892
@@ -897,7 +897,7 @@ public sealed class BSPrim : BSPhysObject
897 { 897 {
898 if (PhysBody.HasPhysicalBody) 898 if (PhysBody.HasPhysicalBody)
899 { 899 {
900 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 900 PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, PhysBody);
901 901
902 // TODO: Fix this. Total kludge because adding object to world resets its gravity to default. 902 // TODO: Fix this. Total kludge because adding object to world resets its gravity to default.
903 // Replace this when the new AddObjectToWorld function is complete. 903 // Replace this when the new AddObjectToWorld function is complete.
@@ -941,9 +941,9 @@ public sealed class BSPrim : BSPhysObject
941 PhysicsScene.TaintedObject("BSPrim.setFloatOnWater", delegate() 941 PhysicsScene.TaintedObject("BSPrim.setFloatOnWater", delegate()
942 { 942 {
943 if (_floatOnWater) 943 if (_floatOnWater)
944 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 944 CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
945 else 945 else
946 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 946 CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER);
947 }); 947 });
948 } 948 }
949 } 949 }
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
143 { 143 {
144 if (!BulletSimAPI.IsInWorld2(body.ptr)) 144 if (!BulletSimAPI.IsInWorld2(body.ptr))
145 { 145 {
146 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, body.ptr); 146 PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, body);
147 if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,addedToWorld,ref={1}", body.ID, body); 147 if (DDetail) DetailLog("{0},BSShapeCollection.ReferenceBody,addedToWorld,ref={1}", body.ID, body);
148 } 148 }
149 }); 149 });
@@ -168,12 +168,12 @@ public sealed class BSShapeCollection : IDisposable
168 168
169 if (BulletSimAPI.IsInWorld2(body.ptr)) 169 if (BulletSimAPI.IsInWorld2(body.ptr))
170 { 170 {
171 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, body.ptr); 171 PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, body);
172 if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceBody,removingFromWorld. Body={1}", body.ID, body); 172 if (DDetail) DetailLog("{0},BSShapeCollection.DereferenceBody,removingFromWorld. Body={1}", body.ID, body);
173 } 173 }
174 174
175 // Zero any reference to the shape so it is not freed when the body is deleted. 175 // Zero any reference to the shape so it is not freed when the body is deleted.
176 BulletSimAPI.SetCollisionShape2(PhysicsScene.World.ptr, body.ptr, IntPtr.Zero); 176 PhysicsScene.PE.SetCollisionShape(PhysicsScene.World, body, new BulletShape());
177 PhysicsScene.PE.DestroyObject(PhysicsScene.World, body); 177 PhysicsScene.PE.DestroyObject(PhysicsScene.World, body);
178 }); 178 });
179 } 179 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
index a2c085e..01966c0 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
@@ -91,13 +91,12 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
91 // Using the information in m_mapInfo, create the physical representation of the heightmap. 91 // Using the information in m_mapInfo, create the physical representation of the heightmap.
92 private void BuildHeightmapTerrain() 92 private void BuildHeightmapTerrain()
93 { 93 {
94 m_mapInfo.Ptr = BulletSimAPI.CreateHeightMapInfo2(PhysicsScene.World.ptr, m_mapInfo.ID, 94 m_mapInfo.Ptr = PhysicsScene.PE.CreateHeightMapInfo(PhysicsScene.World, m_mapInfo.ID,
95 m_mapInfo.minCoords, m_mapInfo.maxCoords, 95 m_mapInfo.minCoords, m_mapInfo.maxCoords,
96 m_mapInfo.heightMap, BSParam.TerrainCollisionMargin); 96 m_mapInfo.heightMap, BSParam.TerrainCollisionMargin);
97 97
98 // Create the terrain shape from the mapInfo 98 // Create the terrain shape from the mapInfo
99 m_mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(m_mapInfo.Ptr), 99 m_mapInfo.terrainShape = PhysicsScene.PE.CreateTerrainShape(m_mapInfo.Ptr);
100 BSPhysicsShapeType.SHAPE_TERRAIN);
101 100
102 // The terrain object initial position is at the center of the object 101 // The terrain object initial position is at the center of the object
103 Vector3 centerPos; 102 Vector3 centerPos;
@@ -109,22 +108,22 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
109 m_mapInfo.ID, centerPos, Quaternion.Identity); 108 m_mapInfo.ID, centerPos, Quaternion.Identity);
110 109
111 // Set current terrain attributes 110 // Set current terrain attributes
112 BulletSimAPI.SetFriction2(m_mapInfo.terrainBody.ptr, BSParam.TerrainFriction); 111 PhysicsScene.PE.SetFriction(m_mapInfo.terrainBody, BSParam.TerrainFriction);
113 BulletSimAPI.SetHitFraction2(m_mapInfo.terrainBody.ptr, BSParam.TerrainHitFraction); 112 PhysicsScene.PE.SetHitFraction(m_mapInfo.terrainBody, BSParam.TerrainHitFraction);
114 BulletSimAPI.SetRestitution2(m_mapInfo.terrainBody.ptr, BSParam.TerrainRestitution); 113 PhysicsScene.PE.SetRestitution(m_mapInfo.terrainBody, BSParam.TerrainRestitution);
115 BulletSimAPI.SetCollisionFlags2(m_mapInfo.terrainBody.ptr, CollisionFlags.CF_STATIC_OBJECT); 114 PhysicsScene.PE.SetCollisionFlags(m_mapInfo.terrainBody, CollisionFlags.CF_STATIC_OBJECT);
116 115
117 // Return the new terrain to the world of physical objects 116 // Return the new terrain to the world of physical objects
118 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_mapInfo.terrainBody.ptr); 117 PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, m_mapInfo.terrainBody);
119 118
120 // redo its bounding box now that it is in the world 119 // redo its bounding box now that it is in the world
121 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, m_mapInfo.terrainBody.ptr); 120 PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, m_mapInfo.terrainBody);
122 121
123 m_mapInfo.terrainBody.collisionType = CollisionType.Terrain; 122 m_mapInfo.terrainBody.collisionType = CollisionType.Terrain;
124 m_mapInfo.terrainBody.ApplyCollisionMask(); 123 m_mapInfo.terrainBody.ApplyCollisionMask();
125 124
126 // Make it so the terrain will not move or be considered for movement. 125 // Make it so the terrain will not move or be considered for movement.
127 BulletSimAPI.ForceActivationState2(m_mapInfo.terrainBody.ptr, ActivationState.DISABLE_SIMULATION); 126 PhysicsScene.PE.ForceActivationState(m_mapInfo.terrainBody, ActivationState.DISABLE_SIMULATION);
128 127
129 return; 128 return;
130 } 129 }
@@ -136,10 +135,10 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
136 { 135 {
137 if (m_mapInfo.terrainBody.HasPhysicalBody) 136 if (m_mapInfo.terrainBody.HasPhysicalBody)
138 { 137 {
139 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_mapInfo.terrainBody.ptr); 138 PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_mapInfo.terrainBody);
140 // Frees both the body and the shape. 139 // Frees both the body and the shape.
141 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_mapInfo.terrainBody); 140 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_mapInfo.terrainBody);
142 BulletSimAPI.ReleaseHeightMapInfo2(m_mapInfo.Ptr); 141 PhysicsScene.PE.ReleaseHeightMapInfo(m_mapInfo.Ptr);
143 } 142 }
144 } 143 }
145 m_mapInfo = null; 144 m_mapInfo = null;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index d99a50f..590c687 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -133,17 +133,14 @@ public sealed class BSTerrainManager : IDisposable
133 public void CreateInitialGroundPlaneAndTerrain() 133 public void CreateInitialGroundPlaneAndTerrain()
134 { 134 {
135 // The ground plane is here to catch things that are trying to drop to negative infinity 135 // The ground plane is here to catch things that are trying to drop to negative infinity
136 BulletShape groundPlaneShape = new BulletShape( 136 BulletShape groundPlaneShape = PhysicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f, BSParam.TerrainCollisionMargin);
137 BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f,
138 BSParam.TerrainCollisionMargin),
139 BSPhysicsShapeType.SHAPE_GROUNDPLANE);
140 m_groundPlane = PhysicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape, 137 m_groundPlane = PhysicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
141 BSScene.GROUNDPLANE_ID, Vector3.Zero, Quaternion.Identity); 138 BSScene.GROUNDPLANE_ID, Vector3.Zero, Quaternion.Identity);
142 139
143 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr); 140 PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, m_groundPlane);
144 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, m_groundPlane.ptr); 141 PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, m_groundPlane);
145 // Ground plane does not move 142 // Ground plane does not move
146 BulletSimAPI.ForceActivationState2(m_groundPlane.ptr, ActivationState.DISABLE_SIMULATION); 143 PhysicsScene.PE.ForceActivationState(m_groundPlane, ActivationState.DISABLE_SIMULATION);
147 // Everything collides with the ground plane. 144 // Everything collides with the ground plane.
148 m_groundPlane.collisionType = CollisionType.Groundplane; 145 m_groundPlane.collisionType = CollisionType.Groundplane;
149 m_groundPlane.ApplyCollisionMask(); 146 m_groundPlane.ApplyCollisionMask();
@@ -158,7 +155,7 @@ public sealed class BSTerrainManager : IDisposable
158 { 155 {
159 if (m_groundPlane.HasPhysicalBody) 156 if (m_groundPlane.HasPhysicalBody)
160 { 157 {
161 if (BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr)) 158 if (PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_groundPlane))
162 { 159 {
163 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_groundPlane); 160 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_groundPlane);
164 } 161 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
index d8c4972..2f55fc3 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
@@ -114,32 +114,32 @@ public sealed class BSTerrainMesh : BSTerrainPhys
114 } 114 }
115 115
116 // Set current terrain attributes 116 // Set current terrain attributes
117 BulletSimAPI.SetFriction2(m_terrainBody.ptr, BSParam.TerrainFriction); 117 PhysicsScene.PE.SetFriction(m_terrainBody, BSParam.TerrainFriction);
118 BulletSimAPI.SetHitFraction2(m_terrainBody.ptr, BSParam.TerrainHitFraction); 118 PhysicsScene.PE.SetHitFraction(m_terrainBody, BSParam.TerrainHitFraction);
119 BulletSimAPI.SetRestitution2(m_terrainBody.ptr, BSParam.TerrainRestitution); 119 PhysicsScene.PE.SetRestitution(m_terrainBody, BSParam.TerrainRestitution);
120 BulletSimAPI.SetCollisionFlags2(m_terrainBody.ptr, CollisionFlags.CF_STATIC_OBJECT); 120 PhysicsScene.PE.SetCollisionFlags(m_terrainBody, CollisionFlags.CF_STATIC_OBJECT);
121 121
122 // Static objects are not very massive. 122 // Static objects are not very massive.
123 BulletSimAPI.SetMassProps2(m_terrainBody.ptr, 0f, Vector3.Zero); 123 BulletSimAPI.SetMassProps2(m_terrainBody.ptr, 0f, Vector3.Zero);
124 124
125 // Put the new terrain to the world of physical objects 125 // Put the new terrain to the world of physical objects
126 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_terrainBody.ptr); 126 PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, m_terrainBody);
127 127
128 // Redo its bounding box now that it is in the world 128 // Redo its bounding box now that it is in the world
129 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, m_terrainBody.ptr); 129 PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, m_terrainBody);
130 130
131 m_terrainBody.collisionType = CollisionType.Terrain; 131 m_terrainBody.collisionType = CollisionType.Terrain;
132 m_terrainBody.ApplyCollisionMask(); 132 m_terrainBody.ApplyCollisionMask();
133 133
134 // Make it so the terrain will not move or be considered for movement. 134 // Make it so the terrain will not move or be considered for movement.
135 BulletSimAPI.ForceActivationState2(m_terrainBody.ptr, ActivationState.DISABLE_SIMULATION); 135 PhysicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION);
136 } 136 }
137 137
138 public override void Dispose() 138 public override void Dispose()
139 { 139 {
140 if (m_terrainBody.HasPhysicalBody) 140 if (m_terrainBody.HasPhysicalBody)
141 { 141 {
142 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, m_terrainBody.ptr); 142 PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_terrainBody);
143 // Frees both the body and the shape. 143 // Frees both the body and the shape.
144 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_terrainBody); 144 PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_terrainBody);
145 } 145 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index 6b76151..b119f22 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -367,7 +367,6 @@ public abstract void ReleaseBodyInfo(IntPtr obj);
367 367
368public abstract void DestroyObject(BulletWorld sim, BulletBody obj); 368public abstract void DestroyObject(BulletWorld sim, BulletBody obj);
369 369
370 /*
371// ===================================================================================== 370// =====================================================================================
372// Terrain creation and helper routines 371// Terrain creation and helper routines
373public abstract IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords, 372public abstract IntPtr CreateHeightMapInfo(BulletWorld sim, uint id, Vector3 minCoords, Vector3 maxCoords,
@@ -378,9 +377,9 @@ public abstract IntPtr FillHeightMapInfo(BulletWorld sim, IntPtr mapInfo, uint i
378 377
379public abstract bool ReleaseHeightMapInfo(IntPtr heightMapInfo); 378public abstract bool ReleaseHeightMapInfo(IntPtr heightMapInfo);
380 379
381public abstract BulletBody CreateGroundPlaneShape(uint id, float height, float collisionMargin); 380public abstract BulletShape CreateGroundPlaneShape(uint id, float height, float collisionMargin);
382 381
383public abstract BulletBody CreateTerrainShape(IntPtr mapInfo); 382public abstract BulletShape CreateTerrainShape(IntPtr mapInfo);
384 383
385// ===================================================================================== 384// =====================================================================================
386// Constraint creation and helper routines 385// Constraint creation and helper routines
@@ -460,7 +459,7 @@ public abstract bool IsStaticOrKinematicObject(BulletBody obj);
460 459
461public abstract bool HasContactResponse(BulletBody obj); 460public abstract bool HasContactResponse(BulletBody obj);
462 461
463public abstract void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletBody shape); 462public abstract void SetCollisionShape(BulletWorld sim, BulletBody obj, BulletShape shape);
464 463
465public abstract BulletShape GetCollisionShape(BulletBody obj); 464public abstract BulletShape GetCollisionShape(BulletBody obj);
466 465
@@ -526,6 +525,7 @@ public abstract IntPtr GetUserPointer(BulletBody obj);
526 525
527public abstract void SetUserPointer(BulletBody obj, IntPtr val); 526public abstract void SetUserPointer(BulletBody obj, IntPtr val);
528 527
528 /*
529// ===================================================================================== 529// =====================================================================================
530// btRigidBody entries 530// btRigidBody entries
531public abstract void ApplyGravity(BulletBody obj); 531public abstract void ApplyGravity(BulletBody obj);