aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
diff options
context:
space:
mode:
authorRobert Adams2011-08-05 11:01:27 -0700
committerMic Bowman2011-08-05 11:01:27 -0700
commit7640b5abf651e51ae2efd5f79f440768a595dbc9 (patch)
tree0b96cd6d2749f95888566f3e04f9798e04c21acd /OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
parentBulletSim: Update dlls (diff)
downloadopensim-SC_OLD-7640b5abf651e51ae2efd5f79f440768a595dbc9.zip
opensim-SC_OLD-7640b5abf651e51ae2efd5f79f440768a595dbc9.tar.gz
opensim-SC_OLD-7640b5abf651e51ae2efd5f79f440768a595dbc9.tar.bz2
opensim-SC_OLD-7640b5abf651e51ae2efd5f79f440768a595dbc9.tar.xz
BulletSim: Parameters settable from ini file. Linksets. Physical property value tuning
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs44
1 files changed, 40 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index ace8158..819fce1 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -32,12 +32,14 @@ using OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.BulletSPlugin { 33namespace OpenSim.Region.Physics.BulletSPlugin {
34 34
35[StructLayout(LayoutKind.Sequential)]
35public struct ConvexHull 36public struct ConvexHull
36{ 37{
37 Vector3 Offset; 38 Vector3 Offset;
38 int VertexCount; 39 int VertexCount;
39 Vector3[] Vertices; 40 Vector3[] Vertices;
40} 41}
42[StructLayout(LayoutKind.Sequential)]
41public struct ShapeData 43public struct ShapeData
42{ 44{
43 public enum PhysicsShapeType 45 public enum PhysicsShapeType
@@ -49,6 +51,7 @@ public struct ShapeData
49 SHAPE_SPHERE = 4, 51 SHAPE_SPHERE = 4,
50 SHAPE_HULL = 5 52 SHAPE_HULL = 5
51 }; 53 };
54 // note that bools are passed as ints since bool size changes by language
52 public const int numericTrue = 1; 55 public const int numericTrue = 1;
53 public const int numericFalse = 0; 56 public const int numericFalse = 0;
54 public uint ID; 57 public uint ID;
@@ -60,11 +63,12 @@ public struct ShapeData
60 public float Mass; 63 public float Mass;
61 public float Buoyancy; 64 public float Buoyancy;
62 public System.UInt64 MeshKey; 65 public System.UInt64 MeshKey;
63 public int Collidable;
64 public float Friction; 66 public float Friction;
67 public float Restitution;
68 public int Collidable;
65 public int Static; // true if a static object. Otherwise gravity, etc. 69 public int Static; // true if a static object. Otherwise gravity, etc.
66 // note that bools are passed as ints since bool size changes by language
67} 70}
71[StructLayout(LayoutKind.Sequential)]
68public struct SweepHit 72public struct SweepHit
69{ 73{
70 public uint ID; 74 public uint ID;
@@ -72,12 +76,14 @@ public struct SweepHit
72 public Vector3 Normal; 76 public Vector3 Normal;
73 public Vector3 Point; 77 public Vector3 Point;
74} 78}
79[StructLayout(LayoutKind.Sequential)]
75public struct RaycastHit 80public struct RaycastHit
76{ 81{
77 public uint ID; 82 public uint ID;
78 public float Fraction; 83 public float Fraction;
79 public Vector3 Normal; 84 public Vector3 Normal;
80} 85}
86[StructLayout(LayoutKind.Sequential)]
81public struct CollisionDesc 87public struct CollisionDesc
82{ 88{
83 public uint aID; 89 public uint aID;
@@ -85,6 +91,7 @@ public struct CollisionDesc
85 public Vector3 point; 91 public Vector3 point;
86 public Vector3 normal; 92 public Vector3 normal;
87} 93}
94[StructLayout(LayoutKind.Sequential)]
88public struct EntityProperties 95public struct EntityProperties
89{ 96{
90 public uint ID; 97 public uint ID;
@@ -92,13 +99,42 @@ public struct EntityProperties
92 public Quaternion Rotation; 99 public Quaternion Rotation;
93 public Vector3 Velocity; 100 public Vector3 Velocity;
94 public Vector3 Acceleration; 101 public Vector3 Acceleration;
95 public Vector3 AngularVelocity; 102 public Vector3 RotationalVelocity;
103}
104
105// Format of this structure must match the definition in the C++ code
106[StructLayout(LayoutKind.Sequential)]
107public struct ConfigurationParameters
108{
109 public float defaultFriction;
110 public float defaultDensity;
111 public float defaultRestitution;
112 public float collisionMargin;
113 public float gravity;
114
115 public float linearDamping;
116 public float angularDamping;
117 public float deactivationTime;
118 public float linearSleepingThreshold;
119 public float angularSleepingThreshold;
120 public float ccdMotionThreshold;
121 public float ccdSweptSphereRadius;
122
123 public float terrainFriction;
124 public float terrainHitFriction;
125 public float terrainRestitution;
126 public float avatarFriction;
127 public float avatarDensity;
128 public float avatarRestitution;
129 public float avatarCapsuleRadius;
130 public float avatarCapsuleHeight;
96} 131}
97 132
98static class BulletSimAPI { 133static class BulletSimAPI {
99 134
100[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 135[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
101public static extern uint Initialize(Vector3 maxPosition, int maxCollisions, IntPtr collisionArray, 136public static extern uint Initialize(Vector3 maxPosition, IntPtr parms,
137 int maxCollisions, IntPtr collisionArray,
102 int maxUpdates, IntPtr updateArray); 138 int maxUpdates, IntPtr updateArray);
103 139
104[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 140[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]