diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index 28fae13..4647c2d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -88,11 +88,11 @@ public struct BulletShape | |||
88 | public BulletShape(IntPtr xx) | 88 | public BulletShape(IntPtr xx) |
89 | { | 89 | { |
90 | ptr = xx; | 90 | ptr = xx; |
91 | type=ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; | 91 | type=PhysicsShapeType.SHAPE_UNKNOWN; |
92 | shapeKey = 0; | 92 | shapeKey = (System.UInt64)FixedShapeKey.KEY_NONE; |
93 | isNativeShape = false; | 93 | isNativeShape = false; |
94 | } | 94 | } |
95 | public BulletShape(IntPtr xx, ShapeData.PhysicsShapeType typ) | 95 | public BulletShape(IntPtr xx, PhysicsShapeType typ) |
96 | { | 96 | { |
97 | ptr = xx; | 97 | ptr = xx; |
98 | type = typ; | 98 | type = typ; |
@@ -100,7 +100,7 @@ public struct BulletShape | |||
100 | isNativeShape = false; | 100 | isNativeShape = false; |
101 | } | 101 | } |
102 | public IntPtr ptr; | 102 | public IntPtr ptr; |
103 | public ShapeData.PhysicsShapeType type; | 103 | public PhysicsShapeType type; |
104 | public System.UInt64 shapeKey; | 104 | public System.UInt64 shapeKey; |
105 | public bool isNativeShape; | 105 | public bool isNativeShape; |
106 | public override string ToString() | 106 | public override string ToString() |
@@ -152,7 +152,7 @@ public class BulletHeightMapInfo | |||
152 | ID = id; | 152 | ID = id; |
153 | Ptr = xx; | 153 | Ptr = xx; |
154 | heightMap = hm; | 154 | heightMap = hm; |
155 | terrainRegionBase = new Vector2(0f, 0f); | 155 | terrainRegionBase = Vector3.Zero; |
156 | minCoords = new Vector3(100f, 100f, 25f); | 156 | minCoords = new Vector3(100f, 100f, 25f); |
157 | maxCoords = new Vector3(101f, 101f, 26f); | 157 | maxCoords = new Vector3(101f, 101f, 26f); |
158 | minZ = maxZ = 0f; | 158 | minZ = maxZ = 0f; |
@@ -161,7 +161,7 @@ public class BulletHeightMapInfo | |||
161 | public uint ID; | 161 | public uint ID; |
162 | public IntPtr Ptr; | 162 | public IntPtr Ptr; |
163 | public float[] heightMap; | 163 | public float[] heightMap; |
164 | public Vector2 terrainRegionBase; | 164 | public Vector3 terrainRegionBase; |
165 | public Vector3 minCoords; | 165 | public Vector3 minCoords; |
166 | public Vector3 maxCoords; | 166 | public Vector3 maxCoords; |
167 | public float sizeX, sizeY; | 167 | public float sizeX, sizeY; |
@@ -178,24 +178,37 @@ public struct ConvexHull | |||
178 | int VertexCount; | 178 | int VertexCount; |
179 | Vector3[] Vertices; | 179 | Vector3[] Vertices; |
180 | } | 180 | } |
181 | public enum PhysicsShapeType | ||
182 | { | ||
183 | SHAPE_UNKNOWN = 0, | ||
184 | SHAPE_CAPSULE = 1, | ||
185 | SHAPE_BOX = 2, | ||
186 | SHAPE_CONE = 3, | ||
187 | SHAPE_CYLINDER = 4, | ||
188 | SHAPE_SPHERE = 5, | ||
189 | SHAPE_MESH = 6, | ||
190 | SHAPE_HULL = 7, | ||
191 | // following defined by BulletSim | ||
192 | SHAPE_GROUNDPLANE = 20, | ||
193 | SHAPE_TERRAIN = 21, | ||
194 | SHAPE_COMPOUND = 22, | ||
195 | SHAPE_HEIGHTMAP = 23, | ||
196 | }; | ||
197 | |||
198 | // The native shapes have predefined shape hash keys | ||
199 | public enum FixedShapeKey : ulong | ||
200 | { | ||
201 | KEY_NONE = 0, | ||
202 | KEY_BOX = 1, | ||
203 | KEY_SPHERE = 2, | ||
204 | KEY_CONE = 3, | ||
205 | KEY_CYLINDER = 4, | ||
206 | KEY_CAPSULE = 5, | ||
207 | } | ||
208 | |||
181 | [StructLayout(LayoutKind.Sequential)] | 209 | [StructLayout(LayoutKind.Sequential)] |
182 | public struct ShapeData | 210 | public struct ShapeData |
183 | { | 211 | { |
184 | public enum PhysicsShapeType | ||
185 | { | ||
186 | SHAPE_UNKNOWN = 0, | ||
187 | SHAPE_AVATAR = 1, | ||
188 | SHAPE_BOX = 2, | ||
189 | SHAPE_CONE = 3, | ||
190 | SHAPE_CYLINDER = 4, | ||
191 | SHAPE_SPHERE = 5, | ||
192 | SHAPE_MESH = 6, | ||
193 | SHAPE_HULL = 7, | ||
194 | // following defined by BulletSim | ||
195 | SHAPE_GROUNDPLANE = 20, | ||
196 | SHAPE_TERRAIN = 21, | ||
197 | SHAPE_COMPOUND = 22, | ||
198 | }; | ||
199 | public uint ID; | 212 | public uint ID; |
200 | public PhysicsShapeType Type; | 213 | public PhysicsShapeType Type; |
201 | public Vector3 Position; | 214 | public Vector3 Position; |
@@ -216,16 +229,6 @@ public struct ShapeData | |||
216 | // note that bools are passed as floats since bool size changes by language and architecture | 229 | // note that bools are passed as floats since bool size changes by language and architecture |
217 | public const float numericTrue = 1f; | 230 | public const float numericTrue = 1f; |
218 | public const float numericFalse = 0f; | 231 | public const float numericFalse = 0f; |
219 | |||
220 | // The native shapes have predefined shape hash keys | ||
221 | public enum FixedShapeKey : ulong | ||
222 | { | ||
223 | KEY_BOX = 1, | ||
224 | KEY_SPHERE = 2, | ||
225 | KEY_CONE = 3, | ||
226 | KEY_CYLINDER = 4, | ||
227 | KEY_CAPSULE = 5, | ||
228 | } | ||
229 | } | 232 | } |
230 | [StructLayout(LayoutKind.Sequential)] | 233 | [StructLayout(LayoutKind.Sequential)] |
231 | public struct SweepHit | 234 | public struct SweepHit |
@@ -280,6 +283,7 @@ public struct ConfigurationParameters | |||
280 | public float ccdSweptSphereRadius; | 283 | public float ccdSweptSphereRadius; |
281 | public float contactProcessingThreshold; | 284 | public float contactProcessingThreshold; |
282 | 285 | ||
286 | public float terrainImplementation; | ||
283 | public float terrainFriction; | 287 | public float terrainFriction; |
284 | public float terrainHitFraction; | 288 | public float terrainHitFraction; |
285 | public float terrainRestitution; | 289 | public float terrainRestitution; |
@@ -287,7 +291,8 @@ public struct ConfigurationParameters | |||
287 | public float avatarStandingFriction; | 291 | public float avatarStandingFriction; |
288 | public float avatarDensity; | 292 | public float avatarDensity; |
289 | public float avatarRestitution; | 293 | public float avatarRestitution; |
290 | public float avatarCapsuleRadius; | 294 | public float avatarCapsuleWidth; |
295 | public float avatarCapsuleDepth; | ||
291 | public float avatarCapsuleHeight; | 296 | public float avatarCapsuleHeight; |
292 | public float avatarContactProcessingThreshold; | 297 | public float avatarContactProcessingThreshold; |
293 | 298 | ||
@@ -388,13 +393,13 @@ public enum CollisionFilterGroups : uint | |||
388 | ObjectFilter = BSolidFilter, | 393 | ObjectFilter = BSolidFilter, |
389 | ObjectMask = BAllFilter, | 394 | ObjectMask = BAllFilter, |
390 | StaticObjectFilter = BStaticFilter, | 395 | StaticObjectFilter = BStaticFilter, |
391 | StaticObjectMask = BAllFilter, | 396 | StaticObjectMask = BAllFilter & ~BStaticFilter, // static objects don't collide with each other |
392 | LinksetFilter = BLinksetFilter, | 397 | LinksetFilter = BLinksetFilter, |
393 | LinksetMask = BAllFilter & ~BLinksetFilter, | 398 | LinksetMask = BAllFilter & ~BLinksetFilter, // linkset objects don't collide with each other |
394 | VolumeDetectFilter = BSensorTrigger, | 399 | VolumeDetectFilter = BSensorTrigger, |
395 | VolumeDetectMask = ~BSensorTrigger, | 400 | VolumeDetectMask = ~BSensorTrigger, |
396 | TerrainFilter = BTerrainFilter, | 401 | TerrainFilter = BTerrainFilter, |
397 | TerrainMask = BAllFilter & ~BStaticFilter, | 402 | TerrainMask = BAllFilter & ~BStaticFilter, // static objects on the ground don't collide |
398 | GroundPlaneFilter = BGroundPlaneFilter, | 403 | GroundPlaneFilter = BGroundPlaneFilter, |
399 | GroundPlaneMask = BAllFilter | 404 | GroundPlaneMask = BAllFilter |
400 | 405 | ||