aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
diff options
context:
space:
mode:
authorRobert Adams2012-09-20 10:12:51 -0700
committerRobert Adams2012-09-27 22:01:26 -0700
commit22290ef35aa13edb1501c69b3cce63a885302563 (patch)
tree2c4762479fb5336c3338acdd2d761fc8c15a04e9 /OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
parentBulletSim: add class and infrastructure for shape and object (diff)
downloadopensim-SC_OLD-22290ef35aa13edb1501c69b3cce63a885302563.zip
opensim-SC_OLD-22290ef35aa13edb1501c69b3cce63a885302563.tar.gz
opensim-SC_OLD-22290ef35aa13edb1501c69b3cce63a885302563.tar.bz2
opensim-SC_OLD-22290ef35aa13edb1501c69b3cce63a885302563.tar.xz
BulletSim: complete code for managed code shape and body tracking. Not debugged.
Eliminate some null exceptions created adding the above code. Add and remove some detailed logging statements.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs43
1 files changed, 39 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index 52c8a24..47875b0 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -40,7 +40,9 @@ public struct BulletSim
40{ 40{
41 public BulletSim(uint worldId, BSScene bss, IntPtr xx) 41 public BulletSim(uint worldId, BSScene bss, IntPtr xx)
42 { 42 {
43 worldID = worldId; scene = bss; Ptr = xx; 43 worldID = worldId;
44 scene = bss;
45 Ptr = xx;
44 } 46 }
45 public uint worldID; 47 public uint worldID;
46 // The scene is only in here so very low level routines have a handle to print debug/error messages 48 // The scene is only in here so very low level routines have a handle to print debug/error messages
@@ -58,6 +60,16 @@ public struct BulletBody
58 } 60 }
59 public IntPtr Ptr; 61 public IntPtr Ptr;
60 public uint ID; 62 public uint ID;
63 public override string ToString()
64 {
65 StringBuilder buff = new StringBuilder();
66 buff.Append("<id=");
67 buff.Append(ID.ToString());
68 buff.Append(",p=");
69 buff.Append(Ptr.ToString("X"));
70 buff.Append(">");
71 return buff.ToString();
72 }
61} 73}
62 74
63public struct BulletShape 75public struct BulletShape
@@ -66,17 +78,29 @@ public struct BulletShape
66 { 78 {
67 Ptr = xx; 79 Ptr = xx;
68 type=ShapeData.PhysicsShapeType.SHAPE_UNKNOWN; 80 type=ShapeData.PhysicsShapeType.SHAPE_UNKNOWN;
69 hashKey = 0; 81 shapeKey = 0;
70 } 82 }
71 public BulletShape(IntPtr xx, ShapeData.PhysicsShapeType typ) 83 public BulletShape(IntPtr xx, ShapeData.PhysicsShapeType typ)
72 { 84 {
73 Ptr = xx; 85 Ptr = xx;
74 type = typ; 86 type = typ;
75 hashKey = 0; 87 shapeKey = 0;
76 } 88 }
77 public IntPtr Ptr; 89 public IntPtr Ptr;
78 public ShapeData.PhysicsShapeType type; 90 public ShapeData.PhysicsShapeType type;
79 public ulong hashKey; 91 public ulong shapeKey;
92 public override string ToString()
93 {
94 StringBuilder buff = new StringBuilder();
95 buff.Append("<p=");
96 buff.Append(Ptr.ToString("X"));
97 buff.Append(",s=");
98 buff.Append(type.ToString());
99 buff.Append(",k=");
100 buff.Append(shapeKey.ToString("X"));
101 buff.Append(">");
102 return buff.ToString();
103 }
80} 104}
81 105
82// An allocated Bullet btConstraint 106// An allocated Bullet btConstraint
@@ -155,10 +179,21 @@ public struct ShapeData
155 public float Restitution; 179 public float Restitution;
156 public float Collidable; // true of things bump into this 180 public float Collidable; // true of things bump into this
157 public float Static; // true if a static object. Otherwise gravity, etc. 181 public float Static; // true if a static object. Otherwise gravity, etc.
182 public float Solid; // true if object cannot be passed through
183 public Vector3 Size;
158 184
159 // note that bools are passed as floats since bool size changes by language and architecture 185 // note that bools are passed as floats since bool size changes by language and architecture
160 public const float numericTrue = 1f; 186 public const float numericTrue = 1f;
161 public const float numericFalse = 0f; 187 public const float numericFalse = 0f;
188
189 // The native shapes have predefined shape hash keys
190 public enum FixedShapeKey : ulong
191 {
192 KEY_BOX = 1,
193 KEY_SPHERE = 2,
194 KEY_CONE = 3,
195 KEY_CYLINDER = 4,
196 }
162} 197}
163[StructLayout(LayoutKind.Sequential)] 198[StructLayout(LayoutKind.Sequential)]
164public struct SweepHit 199public struct SweepHit