aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/ubOde
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde')
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs1190
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs889
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs48
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs18
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs5
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs778
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs116
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs467
-rw-r--r--OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs16
9 files changed, 1784 insertions, 1743 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs
index 35adf11..42ad391 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs
@@ -44,7 +44,7 @@ using System;
44using System.Runtime.InteropServices; 44using System.Runtime.InteropServices;
45using System.Security; 45using System.Security;
46using OMV = OpenMetaverse; 46using OMV = OpenMetaverse;
47namespace OdeAPI 47namespace OpenSim.Region.PhysicsModule.ubOde
48{ 48{
49//#if dDOUBLE 49//#if dDOUBLE
50// don't see much use in double precision with time steps of 20ms and 10 iterations used on opensim 50// don't see much use in double precision with time steps of 20ms and 10 iterations used on opensim
@@ -54,18 +54,19 @@ namespace OdeAPI
54 using dReal = System.Single; 54 using dReal = System.Single;
55//#endif 55//#endif
56 56
57 public static class d 57 [SuppressUnmanagedCodeSecurityAttribute]
58 internal static class SafeNativeMethods
58 { 59 {
59 public static dReal Infinity = dReal.MaxValue; 60 internal static dReal Infinity = dReal.MaxValue;
60 public static int NTotalBodies = 0; 61 internal static int NTotalBodies = 0;
61 public static int NTotalGeoms = 0; 62 internal static int NTotalGeoms = 0;
62 63
63 public const uint CONTACTS_UNIMPORTANT = 0x80000000; 64 internal const uint CONTACTS_UNIMPORTANT = 0x80000000;
64 65
65 #region Flags and Enumerations 66 #region Flags and Enumerations
66 67
67 [Flags] 68 [Flags]
68 public enum AllocateODEDataFlags : uint 69 internal enum AllocateODEDataFlags : uint
69 { 70 {
70 BasicData = 0, 71 BasicData = 0,
71 CollisionData = 0x00000001, 72 CollisionData = 0x00000001,
@@ -73,13 +74,13 @@ namespace OdeAPI
73 } 74 }
74 75
75 [Flags] 76 [Flags]
76 public enum IniteODEFlags : uint 77 internal enum IniteODEFlags : uint
77 { 78 {
78 dInitFlagManualThreadCleanup = 0x00000001 79 dInitFlagManualThreadCleanup = 0x00000001
79 } 80 }
80 81
81 [Flags] 82 [Flags]
82 public enum ContactFlags : int 83 internal enum ContactFlags : int
83 { 84 {
84 Mu2 = 0x001, 85 Mu2 = 0x001,
85 FDir1 = 0x002, 86 FDir1 = 0x002,
@@ -97,7 +98,7 @@ namespace OdeAPI
97 Approx1 = 0x3000 98 Approx1 = 0x3000
98 } 99 }
99 100
100 public enum GeomClassID : int 101 internal enum GeomClassID : int
101 { 102 {
102 SphereClass, 103 SphereClass,
103 BoxClass, 104 BoxClass,
@@ -121,7 +122,7 @@ namespace OdeAPI
121 MaxUserClasses = 5 122 MaxUserClasses = 5
122 } 123 }
123 124
124 public enum JointType : int 125 internal enum JointType : int
125 { 126 {
126 None, 127 None,
127 Ball, 128 Ball,
@@ -137,7 +138,7 @@ namespace OdeAPI
137 Plane2D 138 Plane2D
138 } 139 }
139 140
140 public enum JointParam : int 141 internal enum JointParam : int
141 { 142 {
142 LoStop, 143 LoStop,
143 HiStop, 144 HiStop,
@@ -174,7 +175,7 @@ namespace OdeAPI
174 SuspensionCFM3 175 SuspensionCFM3
175 } 176 }
176 177
177 public enum dSweepAndPruneAxis : int 178 internal enum dSweepAndPruneAxis : int
178 { 179 {
179 XYZ = ((0)|(1<<2)|(2<<4)), 180 XYZ = ((0)|(1<<2)|(2<<4)),
180 XZY = ((0)|(2<<2)|(1<<4)), 181 XZY = ((0)|(2<<2)|(1<<4)),
@@ -189,126 +190,126 @@ namespace OdeAPI
189 #region Callbacks 190 #region Callbacks
190 191
191 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 192 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
192 public delegate int AABBTestFn(IntPtr o1, IntPtr o2, ref AABB aabb); 193 internal delegate int AABBTestFn(IntPtr o1, IntPtr o2, ref AABB aabb);
193 194
194 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 195 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
195 public delegate int ColliderFn(IntPtr o1, IntPtr o2, int flags, out ContactGeom contact, int skip); 196 internal delegate int ColliderFn(IntPtr o1, IntPtr o2, int flags, out ContactGeom contact, int skip);
196 197
197 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 198 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
198 public delegate void GetAABBFn(IntPtr geom, out AABB aabb); 199 internal delegate void GetAABBFn(IntPtr geom, out AABB aabb);
199 200
200 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 201 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
201 public delegate ColliderFn GetColliderFnFn(int num); 202 internal delegate ColliderFn GetColliderFnFn(int num);
202 203
203 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 204 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
204 public delegate void GeomDtorFn(IntPtr o); 205 internal delegate void GeomDtorFn(IntPtr o);
205 206
206 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 207 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
207 public delegate dReal HeightfieldGetHeight(IntPtr p_user_data, int x, int z); 208 internal delegate dReal HeightfieldGetHeight(IntPtr p_user_data, int x, int z);
208 209
209 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 210 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
210 public delegate dReal OSTerrainGetHeight(IntPtr p_user_data, int x, int z); 211 internal delegate dReal OSTerrainGetHeight(IntPtr p_user_data, int x, int z);
211 212
212 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 213 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
213 public delegate void NearCallback(IntPtr data, IntPtr geom1, IntPtr geom2); 214 internal delegate void NearCallback(IntPtr data, IntPtr geom1, IntPtr geom2);
214 215
215 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 216 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
216 public delegate int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex); 217 internal delegate int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex);
217 218
218 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 219 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
219 public delegate int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount); 220 internal delegate int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount);
220 221
221 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 222 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
222 public delegate int TriRayCallback(IntPtr trimesh, IntPtr ray, int triangleIndex, dReal u, dReal v); 223 internal delegate int TriRayCallback(IntPtr trimesh, IntPtr ray, int triangleIndex, dReal u, dReal v);
223 224
224 #endregion 225 #endregion
225 226
226 #region Structs 227 #region Structs
227 228
228 [StructLayout(LayoutKind.Sequential)] 229 [StructLayout(LayoutKind.Sequential)]
229 public struct AABB 230 internal struct AABB
230 { 231 {
231 public dReal MinX, MaxX; 232 internal dReal MinX, MaxX;
232 public dReal MinY, MaxY; 233 internal dReal MinY, MaxY;
233 public dReal MinZ, MaxZ; 234 internal dReal MinZ, MaxZ;
234 } 235 }
235 236
236 237
237 [StructLayout(LayoutKind.Sequential)] 238 [StructLayout(LayoutKind.Sequential)]
238 public struct Contact 239 internal struct Contact
239 { 240 {
240 public SurfaceParameters surface; 241 internal SurfaceParameters surface;
241 public ContactGeom geom; 242 internal ContactGeom geom;
242 public Vector3 fdir1; 243 internal Vector3 fdir1;
243 public static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(Contact)); 244 internal static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(Contact));
244 } 245 }
245 246
246 247
247 [StructLayout(LayoutKind.Sequential)] 248 [StructLayout(LayoutKind.Sequential)]
248 public struct ContactGeom 249 internal struct ContactGeom
249 { 250 {
250 251
251 public Vector3 pos; 252 internal Vector3 pos;
252 public Vector3 normal; 253 internal Vector3 normal;
253 public dReal depth; 254 internal dReal depth;
254 public IntPtr g1; 255 internal IntPtr g1;
255 public IntPtr g2; 256 internal IntPtr g2;
256 public int side1; 257 internal int side1;
257 public int side2; 258 internal int side2;
258 public static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(ContactGeom)); 259 internal static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(ContactGeom));
259 } 260 }
260 261
261 [StructLayout(LayoutKind.Sequential)] 262 [StructLayout(LayoutKind.Sequential)]
262 public struct GeomClass 263 internal struct GeomClass
263 { 264 {
264 public int bytes; 265 internal int bytes;
265 public GetColliderFnFn collider; 266 internal GetColliderFnFn collider;
266 public GetAABBFn aabb; 267 internal GetAABBFn aabb;
267 public AABBTestFn aabb_test; 268 internal AABBTestFn aabb_test;
268 public GeomDtorFn dtor; 269 internal GeomDtorFn dtor;
269 } 270 }
270 271
271 272
272 [StructLayout(LayoutKind.Sequential)] 273 [StructLayout(LayoutKind.Sequential)]
273 public struct JointFeedback 274 internal struct JointFeedback
274 { 275 {
275 public Vector3 f1; 276 internal Vector3 f1;
276 public Vector3 t1; 277 internal Vector3 t1;
277 public Vector3 f2; 278 internal Vector3 f2;
278 public Vector3 t2; 279 internal Vector3 t2;
279 } 280 }
280 281
281 282
282 [StructLayout(LayoutKind.Sequential)] 283 [StructLayout(LayoutKind.Sequential)]
283 public struct Mass 284 internal struct Mass
284 { 285 {
285 public dReal mass; 286 internal dReal mass;
286 public Vector4 c; 287 internal Vector4 c;
287 public Matrix3 I; 288 internal Matrix3 I;
288 } 289 }
289 290
290 291
291 [StructLayout(LayoutKind.Sequential)] 292 [StructLayout(LayoutKind.Sequential)]
292 public struct Matrix3 293 internal struct Matrix3
293 { 294 {
294 public Matrix3(dReal m00, dReal m10, dReal m20, dReal m01, dReal m11, dReal m21, dReal m02, dReal m12, dReal m22) 295 internal Matrix3(dReal m00, dReal m10, dReal m20, dReal m01, dReal m11, dReal m21, dReal m02, dReal m12, dReal m22)
295 { 296 {
296 M00 = m00; M10 = m10; M20 = m20; _m30 = 0.0f; 297 M00 = m00; M10 = m10; M20 = m20; _m30 = 0.0f;
297 M01 = m01; M11 = m11; M21 = m21; _m31 = 0.0f; 298 M01 = m01; M11 = m11; M21 = m21; _m31 = 0.0f;
298 M02 = m02; M12 = m12; M22 = m22; _m32 = 0.0f; 299 M02 = m02; M12 = m12; M22 = m22; _m32 = 0.0f;
299 } 300 }
300 public dReal M00, M10, M20; 301 internal dReal M00, M10, M20;
301 private dReal _m30; 302 private dReal _m30;
302 public dReal M01, M11, M21; 303 internal dReal M01, M11, M21;
303 private dReal _m31; 304 private dReal _m31;
304 public dReal M02, M12, M22; 305 internal dReal M02, M12, M22;
305 private dReal _m32; 306 private dReal _m32;
306 } 307 }
307 308
308 [StructLayout(LayoutKind.Sequential)] 309 [StructLayout(LayoutKind.Sequential)]
309 public struct Matrix4 310 internal struct Matrix4
310 { 311 {
311 public Matrix4(dReal m00, dReal m10, dReal m20, dReal m30, 312 internal Matrix4(dReal m00, dReal m10, dReal m20, dReal m30,
312 dReal m01, dReal m11, dReal m21, dReal m31, 313 dReal m01, dReal m11, dReal m21, dReal m31,
313 dReal m02, dReal m12, dReal m22, dReal m32, 314 dReal m02, dReal m12, dReal m22, dReal m32,
314 dReal m03, dReal m13, dReal m23, dReal m33) 315 dReal m03, dReal m13, dReal m23, dReal m33)
@@ -318,312 +319,312 @@ namespace OdeAPI
318 M02 = m02; M12 = m12; M22 = m22; M32 = m32; 319 M02 = m02; M12 = m12; M22 = m22; M32 = m32;
319 M03 = m03; M13 = m13; M23 = m23; M33 = m33; 320 M03 = m03; M13 = m13; M23 = m23; M33 = m33;
320 } 321 }
321 public dReal M00, M10, M20, M30; 322 internal dReal M00, M10, M20, M30;
322 public dReal M01, M11, M21, M31; 323 internal dReal M01, M11, M21, M31;
323 public dReal M02, M12, M22, M32; 324 internal dReal M02, M12, M22, M32;
324 public dReal M03, M13, M23, M33; 325 internal dReal M03, M13, M23, M33;
325 } 326 }
326 327
327 [StructLayout(LayoutKind.Sequential)] 328 [StructLayout(LayoutKind.Sequential)]
328 public struct Quaternion 329 internal struct Quaternion
329 { 330 {
330 public dReal W, X, Y, Z; 331 internal dReal W, X, Y, Z;
331 } 332 }
332 333
333 334
334 [StructLayout(LayoutKind.Sequential)] 335 [StructLayout(LayoutKind.Sequential)]
335 public struct SurfaceParameters 336 internal struct SurfaceParameters
336 { 337 {
337 public ContactFlags mode; 338 internal ContactFlags mode;
338 public dReal mu; 339 internal dReal mu;
339 public dReal mu2; 340 internal dReal mu2;
340 public dReal bounce; 341 internal dReal bounce;
341 public dReal bounce_vel; 342 internal dReal bounce_vel;
342 public dReal soft_erp; 343 internal dReal soft_erp;
343 public dReal soft_cfm; 344 internal dReal soft_cfm;
344 public dReal motion1; 345 internal dReal motion1;
345 public dReal motion2; 346 internal dReal motion2;
346 public dReal motionN; 347 internal dReal motionN;
347 public dReal slip1; 348 internal dReal slip1;
348 public dReal slip2; 349 internal dReal slip2;
349 } 350 }
350 351
351 352
352 [StructLayout(LayoutKind.Sequential)] 353 [StructLayout(LayoutKind.Sequential)]
353 public struct Vector3 354 internal struct Vector3
354 { 355 {
355 public Vector3(dReal x, dReal y, dReal z) 356 internal Vector3(dReal x, dReal y, dReal z)
356 { 357 {
357 X = x; Y = y; Z = z; _w = 0.0f; 358 X = x; Y = y; Z = z; _w = 0.0f;
358 } 359 }
359 public dReal X, Y, Z; 360 internal dReal X, Y, Z;
360 private dReal _w; 361 private dReal _w;
361 } 362 }
362 363
363 364
364 [StructLayout(LayoutKind.Sequential)] 365 [StructLayout(LayoutKind.Sequential)]
365 public struct Vector4 366 internal struct Vector4
366 { 367 {
367 public Vector4(dReal x, dReal y, dReal z, dReal w) 368 internal Vector4(dReal x, dReal y, dReal z, dReal w)
368 { 369 {
369 X = x; Y = y; Z = z; W = w; 370 X = x; Y = y; Z = z; W = w;
370 } 371 }
371 public dReal X, Y, Z, W; 372 internal dReal X, Y, Z, W;
372 } 373 }
373 374
374 #endregion 375 #endregion
375 376
376 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAllocateODEDataForThread"), SuppressUnmanagedCodeSecurity] 377 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAllocateODEDataForThread"), SuppressUnmanagedCodeSecurity]
377 public static extern int AllocateODEDataForThread(uint ODEInitFlags); 378 internal static extern int AllocateODEDataForThread(uint ODEInitFlags);
378 379
379 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAreConnected"), SuppressUnmanagedCodeSecurity] 380 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAreConnected"), SuppressUnmanagedCodeSecurity]
380 public static extern bool AreConnected(IntPtr b1, IntPtr b2); 381 internal static extern bool AreConnected(IntPtr b1, IntPtr b2);
381 382
382 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAreConnectedExcluding"), SuppressUnmanagedCodeSecurity] 383 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAreConnectedExcluding"), SuppressUnmanagedCodeSecurity]
383 public static extern bool AreConnectedExcluding(IntPtr b1, IntPtr b2, JointType joint_type); 384 internal static extern bool AreConnectedExcluding(IntPtr b1, IntPtr b2, JointType joint_type);
384 385
385 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForce"), SuppressUnmanagedCodeSecurity] 386 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForce"), SuppressUnmanagedCodeSecurity]
386 public static extern void BodyAddForce(IntPtr body, dReal fx, dReal fy, dReal fz); 387 internal static extern void BodyAddForce(IntPtr body, dReal fx, dReal fy, dReal fz);
387 388
388 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForceAtPos"), SuppressUnmanagedCodeSecurity] 389 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForceAtPos"), SuppressUnmanagedCodeSecurity]
389 public static extern void BodyAddForceAtPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); 390 internal static extern void BodyAddForceAtPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz);
390 391
391 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForceAtRelPos"), SuppressUnmanagedCodeSecurity] 392 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForceAtRelPos"), SuppressUnmanagedCodeSecurity]
392 public static extern void BodyAddForceAtRelPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); 393 internal static extern void BodyAddForceAtRelPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz);
393 394
394 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForce"), SuppressUnmanagedCodeSecurity] 395 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForce"), SuppressUnmanagedCodeSecurity]
395 public static extern void BodyAddRelForce(IntPtr body, dReal fx, dReal fy, dReal fz); 396 internal static extern void BodyAddRelForce(IntPtr body, dReal fx, dReal fy, dReal fz);
396 397
397 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForceAtPos"), SuppressUnmanagedCodeSecurity] 398 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForceAtPos"), SuppressUnmanagedCodeSecurity]
398 public static extern void BodyAddRelForceAtPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); 399 internal static extern void BodyAddRelForceAtPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz);
399 400
400 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForceAtRelPos"), SuppressUnmanagedCodeSecurity] 401 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForceAtRelPos"), SuppressUnmanagedCodeSecurity]
401 public static extern void BodyAddRelForceAtRelPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); 402 internal static extern void BodyAddRelForceAtRelPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz);
402 403
403 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelTorque"), SuppressUnmanagedCodeSecurity] 404 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelTorque"), SuppressUnmanagedCodeSecurity]
404 public static extern void BodyAddRelTorque(IntPtr body, dReal fx, dReal fy, dReal fz); 405 internal static extern void BodyAddRelTorque(IntPtr body, dReal fx, dReal fy, dReal fz);
405 406
406 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddTorque"), SuppressUnmanagedCodeSecurity] 407 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddTorque"), SuppressUnmanagedCodeSecurity]
407 public static extern void BodyAddTorque(IntPtr body, dReal fx, dReal fy, dReal fz); 408 internal static extern void BodyAddTorque(IntPtr body, dReal fx, dReal fy, dReal fz);
408 409
409 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyPosition"), SuppressUnmanagedCodeSecurity] 410 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyPosition"), SuppressUnmanagedCodeSecurity]
410 public static extern void BodyCopyPosition(IntPtr body, out Vector3 pos); 411 internal static extern void BodyCopyPosition(IntPtr body, out Vector3 pos);
411 412
412 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyPosition"), SuppressUnmanagedCodeSecurity] 413 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyPosition"), SuppressUnmanagedCodeSecurity]
413 public static extern void BodyCopyPosition(IntPtr body, out dReal X); 414 internal static extern void BodyCopyPosition(IntPtr body, out dReal X);
414 415
415 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyQuaternion"), SuppressUnmanagedCodeSecurity] 416 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyQuaternion"), SuppressUnmanagedCodeSecurity]
416 public static extern void BodyCopyQuaternion(IntPtr body, out Quaternion quat); 417 internal static extern void BodyCopyQuaternion(IntPtr body, out Quaternion quat);
417 418
418 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyQuaternion"), SuppressUnmanagedCodeSecurity] 419 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyQuaternion"), SuppressUnmanagedCodeSecurity]
419 public static extern void BodyCopyQuaternion(IntPtr body, out dReal X); 420 internal static extern void BodyCopyQuaternion(IntPtr body, out dReal X);
420 421
421 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyRotation"), SuppressUnmanagedCodeSecurity] 422 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyRotation"), SuppressUnmanagedCodeSecurity]
422 public static extern void BodyCopyRotation(IntPtr body, out Matrix3 R); 423 internal static extern void BodyCopyRotation(IntPtr body, out Matrix3 R);
423 424
424 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyRotation"), SuppressUnmanagedCodeSecurity] 425 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyRotation"), SuppressUnmanagedCodeSecurity]
425 public static extern void BodyCopyRotation(IntPtr body, out dReal M00); 426 internal static extern void BodyCopyRotation(IntPtr body, out dReal M00);
426 427
427 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCreate"), SuppressUnmanagedCodeSecurity] 428 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCreate"), SuppressUnmanagedCodeSecurity]
428 public static extern IntPtr BodyiCreate(IntPtr world); 429 internal static extern IntPtr BodyiCreate(IntPtr world);
429 public static IntPtr BodyCreate(IntPtr world) 430 internal static IntPtr BodyCreate(IntPtr world)
430 { 431 {
431 NTotalBodies++; 432 NTotalBodies++;
432 return BodyiCreate(world); 433 return BodyiCreate(world);
433 } 434 }
434 435
435 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyDestroy"), SuppressUnmanagedCodeSecurity] 436 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyDestroy"), SuppressUnmanagedCodeSecurity]
436 public static extern void BodyiDestroy(IntPtr body); 437 internal static extern void BodyiDestroy(IntPtr body);
437 public static void BodyDestroy(IntPtr body) 438 internal static void BodyDestroy(IntPtr body)
438 { 439 {
439 NTotalBodies--; 440 NTotalBodies--;
440 BodyiDestroy(body); 441 BodyiDestroy(body);
441 } 442 }
442 443
443 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyDisable"), SuppressUnmanagedCodeSecurity] 444 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyDisable"), SuppressUnmanagedCodeSecurity]
444 public static extern void BodyDisable(IntPtr body); 445 internal static extern void BodyDisable(IntPtr body);
445 446
446 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyEnable"), SuppressUnmanagedCodeSecurity] 447 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyEnable"), SuppressUnmanagedCodeSecurity]
447 public static extern void BodyEnable(IntPtr body); 448 internal static extern void BodyEnable(IntPtr body);
448 449
449 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] 450 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity]
450 public static extern dReal BodyGetAutoDisableAngularThreshold(IntPtr body); 451 internal static extern dReal BodyGetAutoDisableAngularThreshold(IntPtr body);
451 452
452 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] 453 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableFlag"), SuppressUnmanagedCodeSecurity]
453 public static extern bool BodyGetAutoDisableFlag(IntPtr body); 454 internal static extern bool BodyGetAutoDisableFlag(IntPtr body);
454 455
455 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableDefaults"), SuppressUnmanagedCodeSecurity] 456 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableDefaults"), SuppressUnmanagedCodeSecurity]
456 public static extern void BodyGetAutoDisableDefaults(IntPtr body); 457 internal static extern void BodyGetAutoDisableDefaults(IntPtr body);
457 458
458 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] 459 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity]
459 public static extern dReal BodyGetAutoDisableLinearThreshold(IntPtr body); 460 internal static extern dReal BodyGetAutoDisableLinearThreshold(IntPtr body);
460 461
461 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] 462 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableSteps"), SuppressUnmanagedCodeSecurity]
462 public static extern int BodyGetAutoDisableSteps(IntPtr body); 463 internal static extern int BodyGetAutoDisableSteps(IntPtr body);
463 464
464 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableTime"), SuppressUnmanagedCodeSecurity] 465 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableTime"), SuppressUnmanagedCodeSecurity]
465 public static extern dReal BodyGetAutoDisableTime(IntPtr body); 466 internal static extern dReal BodyGetAutoDisableTime(IntPtr body);
466 467
467 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularVel"), SuppressUnmanagedCodeSecurity] 468 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularVel"), SuppressUnmanagedCodeSecurity]
468 public extern unsafe static Vector3* BodyGetAngularVelUnsafe(IntPtr body); 469 internal extern unsafe static Vector3* BodyGetAngularVelUnsafe(IntPtr body);
469 public static Vector3 BodyGetAngularVel(IntPtr body) 470 internal static Vector3 BodyGetAngularVel(IntPtr body)
470 { 471 {
471 unsafe { return *(BodyGetAngularVelUnsafe(body)); } 472 unsafe { return *(BodyGetAngularVelUnsafe(body)); }
472 } 473 }
473 474
474 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetData"), SuppressUnmanagedCodeSecurity] 475 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetData"), SuppressUnmanagedCodeSecurity]
475 public static extern IntPtr BodyGetData(IntPtr body); 476 internal static extern IntPtr BodyGetData(IntPtr body);
476 477
477 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFiniteRotationMode"), SuppressUnmanagedCodeSecurity] 478 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFiniteRotationMode"), SuppressUnmanagedCodeSecurity]
478 public static extern int BodyGetFiniteRotationMode(IntPtr body); 479 internal static extern int BodyGetFiniteRotationMode(IntPtr body);
479 480
480 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFiniteRotationAxis"), SuppressUnmanagedCodeSecurity] 481 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFiniteRotationAxis"), SuppressUnmanagedCodeSecurity]
481 public static extern void BodyGetFiniteRotationAxis(IntPtr body, out Vector3 result); 482 internal static extern void BodyGetFiniteRotationAxis(IntPtr body, out Vector3 result);
482 483
483 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetForce"), SuppressUnmanagedCodeSecurity] 484 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetForce"), SuppressUnmanagedCodeSecurity]
484 public extern unsafe static Vector3* BodyGetForceUnsafe(IntPtr body); 485 internal extern unsafe static Vector3* BodyGetForceUnsafe(IntPtr body);
485 public static Vector3 BodyGetForce(IntPtr body) 486 internal static Vector3 BodyGetForce(IntPtr body)
486 { 487 {
487 unsafe { return *(BodyGetForceUnsafe(body)); } 488 unsafe { return *(BodyGetForceUnsafe(body)); }
488 } 489 }
489 490
490 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetGravityMode"), SuppressUnmanagedCodeSecurity] 491 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetGravityMode"), SuppressUnmanagedCodeSecurity]
491 public static extern bool BodyGetGravityMode(IntPtr body); 492 internal static extern bool BodyGetGravityMode(IntPtr body);
492 493
493 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetGyroscopicMode"), SuppressUnmanagedCodeSecurity] 494 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetGyroscopicMode"), SuppressUnmanagedCodeSecurity]
494 public static extern int BodyGetGyroscopicMode(IntPtr body); 495 internal static extern int BodyGetGyroscopicMode(IntPtr body);
495 496
496 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetJoint"), SuppressUnmanagedCodeSecurity] 497 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetJoint"), SuppressUnmanagedCodeSecurity]
497 public static extern IntPtr BodyGetJoint(IntPtr body, int index); 498 internal static extern IntPtr BodyGetJoint(IntPtr body, int index);
498 499
499 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearVel"), SuppressUnmanagedCodeSecurity] 500 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearVel"), SuppressUnmanagedCodeSecurity]
500 public extern unsafe static Vector3* BodyGetLinearVelUnsafe(IntPtr body); 501 internal extern unsafe static Vector3* BodyGetLinearVelUnsafe(IntPtr body);
501 public static Vector3 BodyGetLinearVel(IntPtr body) 502 internal static Vector3 BodyGetLinearVel(IntPtr body)
502 { 503 {
503 unsafe { return *(BodyGetLinearVelUnsafe(body)); } 504 unsafe { return *(BodyGetLinearVelUnsafe(body)); }
504 } 505 }
505 506
506 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetMass"), SuppressUnmanagedCodeSecurity] 507 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetMass"), SuppressUnmanagedCodeSecurity]
507 public static extern void BodyGetMass(IntPtr body, out Mass mass); 508 internal static extern void BodyGetMass(IntPtr body, out Mass mass);
508 509
509 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetNumJoints"), SuppressUnmanagedCodeSecurity] 510 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetNumJoints"), SuppressUnmanagedCodeSecurity]
510 public static extern int BodyGetNumJoints(IntPtr body); 511 internal static extern int BodyGetNumJoints(IntPtr body);
511 512
512 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPointVel"), SuppressUnmanagedCodeSecurity] 513 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPointVel"), SuppressUnmanagedCodeSecurity]
513 public static extern void BodyGetPointVel(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); 514 internal static extern void BodyGetPointVel(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result);
514 515
515 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPosition"), SuppressUnmanagedCodeSecurity] 516 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPosition"), SuppressUnmanagedCodeSecurity]
516 public extern unsafe static Vector3* BodyGetPositionUnsafe(IntPtr body); 517 internal extern unsafe static Vector3* BodyGetPositionUnsafe(IntPtr body);
517 public static Vector3 BodyGetPosition(IntPtr body) 518 internal static Vector3 BodyGetPosition(IntPtr body)
518 { 519 {
519 unsafe { return *(BodyGetPositionUnsafe(body)); } 520 unsafe { return *(BodyGetPositionUnsafe(body)); }
520 } 521 }
521 522
522 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPosRelPoint"), SuppressUnmanagedCodeSecurity] 523 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPosRelPoint"), SuppressUnmanagedCodeSecurity]
523 public static extern void BodyGetPosRelPoint(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); 524 internal static extern void BodyGetPosRelPoint(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result);
524 525
525 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetQuaternion"), SuppressUnmanagedCodeSecurity] 526 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetQuaternion"), SuppressUnmanagedCodeSecurity]
526 public extern unsafe static Quaternion* BodyGetQuaternionUnsafe(IntPtr body); 527 internal extern unsafe static Quaternion* BodyGetQuaternionUnsafe(IntPtr body);
527 public static Quaternion BodyGetQuaternion(IntPtr body) 528 internal static Quaternion BodyGetQuaternion(IntPtr body)
528 { 529 {
529 unsafe { return *(BodyGetQuaternionUnsafe(body)); } 530 unsafe { return *(BodyGetQuaternionUnsafe(body)); }
530 } 531 }
531 532
532 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRelPointPos"), SuppressUnmanagedCodeSecurity] 533 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRelPointPos"), SuppressUnmanagedCodeSecurity]
533 public static extern void BodyGetRelPointPos(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); 534 internal static extern void BodyGetRelPointPos(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result);
534 535
535 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRelPointVel"), SuppressUnmanagedCodeSecurity] 536 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRelPointVel"), SuppressUnmanagedCodeSecurity]
536 public static extern void BodyGetRelPointVel(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); 537 internal static extern void BodyGetRelPointVel(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result);
537 538
538 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRotation"), SuppressUnmanagedCodeSecurity] 539 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRotation"), SuppressUnmanagedCodeSecurity]
539 public extern unsafe static Matrix3* BodyGetRotationUnsafe(IntPtr body); 540 internal extern unsafe static Matrix3* BodyGetRotationUnsafe(IntPtr body);
540 public static Matrix3 BodyGetRotation(IntPtr body) 541 internal static Matrix3 BodyGetRotation(IntPtr body)
541 { 542 {
542 unsafe { return *(BodyGetRotationUnsafe(body)); } 543 unsafe { return *(BodyGetRotationUnsafe(body)); }
543 } 544 }
544 545
545 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetTorque"), SuppressUnmanagedCodeSecurity] 546 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetTorque"), SuppressUnmanagedCodeSecurity]
546 public extern unsafe static Vector3* BodyGetTorqueUnsafe(IntPtr body); 547 internal extern unsafe static Vector3* BodyGetTorqueUnsafe(IntPtr body);
547 public static Vector3 BodyGetTorque(IntPtr body) 548 internal static Vector3 BodyGetTorque(IntPtr body)
548 { 549 {
549 unsafe { return *(BodyGetTorqueUnsafe(body)); } 550 unsafe { return *(BodyGetTorqueUnsafe(body)); }
550 } 551 }
551 552
552 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetWorld"), SuppressUnmanagedCodeSecurity] 553 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetWorld"), SuppressUnmanagedCodeSecurity]
553 public static extern IntPtr BodyGetWorld(IntPtr body); 554 internal static extern IntPtr BodyGetWorld(IntPtr body);
554 555
555 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFirstGeom"), SuppressUnmanagedCodeSecurity] 556 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFirstGeom"), SuppressUnmanagedCodeSecurity]
556 public static extern IntPtr BodyGetFirstGeom(IntPtr body); 557 internal static extern IntPtr BodyGetFirstGeom(IntPtr body);
557 558
558 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetNextGeom"), SuppressUnmanagedCodeSecurity] 559 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetNextGeom"), SuppressUnmanagedCodeSecurity]
559 public static extern IntPtr dBodyGetNextGeom(IntPtr Geom); 560 internal static extern IntPtr dBodyGetNextGeom(IntPtr Geom);
560 561
561 562
562 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyIsEnabled"), SuppressUnmanagedCodeSecurity] 563 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyIsEnabled"), SuppressUnmanagedCodeSecurity]
563 public static extern bool BodyIsEnabled(IntPtr body); 564 internal static extern bool BodyIsEnabled(IntPtr body);
564 565
565 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularVel"), SuppressUnmanagedCodeSecurity] 566 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularVel"), SuppressUnmanagedCodeSecurity]
566 public static extern void BodySetAngularVel(IntPtr body, dReal x, dReal y, dReal z); 567 internal static extern void BodySetAngularVel(IntPtr body, dReal x, dReal y, dReal z);
567 568
568 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] 569 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity]
569 public static extern void BodySetAutoDisableAngularThreshold(IntPtr body, dReal angular_threshold); 570 internal static extern void BodySetAutoDisableAngularThreshold(IntPtr body, dReal angular_threshold);
570 571
571 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableDefaults"), SuppressUnmanagedCodeSecurity] 572 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableDefaults"), SuppressUnmanagedCodeSecurity]
572 public static extern void BodySetAutoDisableDefaults(IntPtr body); 573 internal static extern void BodySetAutoDisableDefaults(IntPtr body);
573 574
574 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] 575 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableFlag"), SuppressUnmanagedCodeSecurity]
575 public static extern void BodySetAutoDisableFlag(IntPtr body, bool do_auto_disable); 576 internal static extern void BodySetAutoDisableFlag(IntPtr body, bool do_auto_disable);
576 577
577 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] 578 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity]
578 public static extern void BodySetAutoDisableLinearThreshold(IntPtr body, dReal linear_threshold); 579 internal static extern void BodySetAutoDisableLinearThreshold(IntPtr body, dReal linear_threshold);
579 580
580 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] 581 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableSteps"), SuppressUnmanagedCodeSecurity]
581 public static extern void BodySetAutoDisableSteps(IntPtr body, int steps); 582 internal static extern void BodySetAutoDisableSteps(IntPtr body, int steps);
582 583
583 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableTime"), SuppressUnmanagedCodeSecurity] 584 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableTime"), SuppressUnmanagedCodeSecurity]
584 public static extern void BodySetAutoDisableTime(IntPtr body, dReal time); 585 internal static extern void BodySetAutoDisableTime(IntPtr body, dReal time);
585 586
586 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetData"), SuppressUnmanagedCodeSecurity] 587 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetData"), SuppressUnmanagedCodeSecurity]
587 public static extern void BodySetData(IntPtr body, IntPtr data); 588 internal static extern void BodySetData(IntPtr body, IntPtr data);
588 589
589 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetFiniteRotationMode"), SuppressUnmanagedCodeSecurity] 590 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetFiniteRotationMode"), SuppressUnmanagedCodeSecurity]
590 public static extern void BodySetFiniteRotationMode(IntPtr body, int mode); 591 internal static extern void BodySetFiniteRotationMode(IntPtr body, int mode);
591 592
592 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetFiniteRotationAxis"), SuppressUnmanagedCodeSecurity] 593 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetFiniteRotationAxis"), SuppressUnmanagedCodeSecurity]
593 public static extern void BodySetFiniteRotationAxis(IntPtr body, dReal x, dReal y, dReal z); 594 internal static extern void BodySetFiniteRotationAxis(IntPtr body, dReal x, dReal y, dReal z);
594 595
595 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearDamping"), SuppressUnmanagedCodeSecurity] 596 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearDamping"), SuppressUnmanagedCodeSecurity]
596 public static extern void BodySetLinearDamping(IntPtr body, dReal scale); 597 internal static extern void BodySetLinearDamping(IntPtr body, dReal scale);
597 598
598 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDamping"), SuppressUnmanagedCodeSecurity] 599 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDamping"), SuppressUnmanagedCodeSecurity]
599 public static extern void BodySetAngularDamping(IntPtr body, dReal scale); 600 internal static extern void BodySetAngularDamping(IntPtr body, dReal scale);
600 601
601 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearDamping"), SuppressUnmanagedCodeSecurity] 602 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearDamping"), SuppressUnmanagedCodeSecurity]
602 public static extern dReal BodyGetLinearDamping(IntPtr body); 603 internal static extern dReal BodyGetLinearDamping(IntPtr body);
603 604
604 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularDamping"), SuppressUnmanagedCodeSecurity] 605 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularDamping"), SuppressUnmanagedCodeSecurity]
605 public static extern dReal BodyGetAngularDamping(IntPtr body); 606 internal static extern dReal BodyGetAngularDamping(IntPtr body);
606 607
607 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDamping"), SuppressUnmanagedCodeSecurity] 608 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDamping"), SuppressUnmanagedCodeSecurity]
608 public static extern void BodySetDamping(IntPtr body, dReal linear_scale, dReal angular_scale); 609 internal static extern void BodySetDamping(IntPtr body, dReal linear_scale, dReal angular_scale);
609 610
610 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] 611 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity]
611 public static extern void BodySetAngularDampingThreshold(IntPtr body, dReal threshold); 612 internal static extern void BodySetAngularDampingThreshold(IntPtr body, dReal threshold);
612 613
613 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] 614 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity]
614 public static extern void BodySetLinearDampingThreshold(IntPtr body, dReal threshold); 615 internal static extern void BodySetLinearDampingThreshold(IntPtr body, dReal threshold);
615 616
616 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] 617 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity]
617 public static extern dReal BodyGetLinearDampingThreshold(IntPtr body); 618 internal static extern dReal BodyGetLinearDampingThreshold(IntPtr body);
618 619
619 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] 620 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity]
620 public static extern dReal BodyGetAngularDampingThreshold(IntPtr body); 621 internal static extern dReal BodyGetAngularDampingThreshold(IntPtr body);
621 622
622 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetForce"), SuppressUnmanagedCodeSecurity] 623 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetForce"), SuppressUnmanagedCodeSecurity]
623 public static extern void BodySetForce(IntPtr body, dReal x, dReal y, dReal z); 624 internal static extern void BodySetForce(IntPtr body, dReal x, dReal y, dReal z);
624 625
625 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetGravityMode"), SuppressUnmanagedCodeSecurity] 626 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetGravityMode"), SuppressUnmanagedCodeSecurity]
626 public static extern void BodySetGravityMode(IntPtr body, bool mode); 627 internal static extern void BodySetGravityMode(IntPtr body, bool mode);
627 628
628 /// <summary> 629 /// <summary>
629 /// Sets the Gyroscopic term status on the body specified. 630 /// Sets the Gyroscopic term status on the body specified.
@@ -631,112 +632,112 @@ namespace OdeAPI
631 /// <param name="body">Pointer to body</param> 632 /// <param name="body">Pointer to body</param>
632 /// <param name="enabled">NonZero enabled, Zero disabled</param> 633 /// <param name="enabled">NonZero enabled, Zero disabled</param>
633 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetGyroscopicMode"), SuppressUnmanagedCodeSecurity] 634 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetGyroscopicMode"), SuppressUnmanagedCodeSecurity]
634 public static extern void dBodySetGyroscopicMode(IntPtr body, int enabled); 635 internal static extern void dBodySetGyroscopicMode(IntPtr body, int enabled);
635 636
636 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearVel"), SuppressUnmanagedCodeSecurity] 637 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearVel"), SuppressUnmanagedCodeSecurity]
637 public static extern void BodySetLinearVel(IntPtr body, dReal x, dReal y, dReal z); 638 internal static extern void BodySetLinearVel(IntPtr body, dReal x, dReal y, dReal z);
638 639
639 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetMass"), SuppressUnmanagedCodeSecurity] 640 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetMass"), SuppressUnmanagedCodeSecurity]
640 public static extern void BodySetMass(IntPtr body, ref Mass mass); 641 internal static extern void BodySetMass(IntPtr body, ref Mass mass);
641 642
642 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetPosition"), SuppressUnmanagedCodeSecurity] 643 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetPosition"), SuppressUnmanagedCodeSecurity]
643 public static extern void BodySetPosition(IntPtr body, dReal x, dReal y, dReal z); 644 internal static extern void BodySetPosition(IntPtr body, dReal x, dReal y, dReal z);
644 645
645 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetQuaternion"), SuppressUnmanagedCodeSecurity] 646 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetQuaternion"), SuppressUnmanagedCodeSecurity]
646 public static extern void BodySetQuaternion(IntPtr body, ref Quaternion q); 647 internal static extern void BodySetQuaternion(IntPtr body, ref Quaternion q);
647 648
648 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetQuaternion"), SuppressUnmanagedCodeSecurity] 649 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetQuaternion"), SuppressUnmanagedCodeSecurity]
649 public static extern void BodySetQuaternion(IntPtr body, ref dReal w); 650 internal static extern void BodySetQuaternion(IntPtr body, ref dReal w);
650 651
651 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetRotation"), SuppressUnmanagedCodeSecurity] 652 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetRotation"), SuppressUnmanagedCodeSecurity]
652 public static extern void BodySetRotation(IntPtr body, ref Matrix3 R); 653 internal static extern void BodySetRotation(IntPtr body, ref Matrix3 R);
653 654
654 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetRotation"), SuppressUnmanagedCodeSecurity] 655 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetRotation"), SuppressUnmanagedCodeSecurity]
655 public static extern void BodySetRotation(IntPtr body, ref dReal M00); 656 internal static extern void BodySetRotation(IntPtr body, ref dReal M00);
656 657
657 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetTorque"), SuppressUnmanagedCodeSecurity] 658 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetTorque"), SuppressUnmanagedCodeSecurity]
658 public static extern void BodySetTorque(IntPtr body, dReal x, dReal y, dReal z); 659 internal static extern void BodySetTorque(IntPtr body, dReal x, dReal y, dReal z);
659 660
660 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyVectorFromWorld"), SuppressUnmanagedCodeSecurity] 661 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyVectorFromWorld"), SuppressUnmanagedCodeSecurity]
661 public static extern void BodyVectorFromWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); 662 internal static extern void BodyVectorFromWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result);
662 663
663 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyVectorToWorld"), SuppressUnmanagedCodeSecurity] 664 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyVectorToWorld"), SuppressUnmanagedCodeSecurity]
664 public static extern void BodyVectorToWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); 665 internal static extern void BodyVectorToWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result);
665 666
666 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBoxBox"), SuppressUnmanagedCodeSecurity] 667 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBoxBox"), SuppressUnmanagedCodeSecurity]
667 public static extern void BoxBox(ref Vector3 p1, ref Matrix3 R1, 668 internal static extern void BoxBox(ref Vector3 p1, ref Matrix3 R1,
668 ref Vector3 side1, ref Vector3 p2, 669 ref Vector3 side1, ref Vector3 p2,
669 ref Matrix3 R2, ref Vector3 side2, 670 ref Matrix3 R2, ref Vector3 side2,
670 ref Vector3 normal, out dReal depth, out int return_code, 671 ref Vector3 normal, out dReal depth, out int return_code,
671 int maxc, out ContactGeom contact, int skip); 672 int maxc, out ContactGeom contact, int skip);
672 673
673 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBoxTouchesBox"), SuppressUnmanagedCodeSecurity] 674 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBoxTouchesBox"), SuppressUnmanagedCodeSecurity]
674 public static extern void BoxTouchesBox(ref Vector3 _p1, ref Matrix3 R1, 675 internal static extern void BoxTouchesBox(ref Vector3 _p1, ref Matrix3 R1,
675 ref Vector3 side1, ref Vector3 _p2, 676 ref Vector3 side1, ref Vector3 _p2,
676 ref Matrix3 R2, ref Vector3 side2); 677 ref Matrix3 R2, ref Vector3 side2);
677 678
678 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCleanupODEAllDataForThread"), SuppressUnmanagedCodeSecurity] 679 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCleanupODEAllDataForThread"), SuppressUnmanagedCodeSecurity]
679 public static extern void CleanupODEAllDataForThread(); 680 internal static extern void CleanupODEAllDataForThread();
680 681
681 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dClosestLineSegmentPoints"), SuppressUnmanagedCodeSecurity] 682 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dClosestLineSegmentPoints"), SuppressUnmanagedCodeSecurity]
682 public static extern void ClosestLineSegmentPoints(ref Vector3 a1, ref Vector3 a2, 683 internal static extern void ClosestLineSegmentPoints(ref Vector3 a1, ref Vector3 a2,
683 ref Vector3 b1, ref Vector3 b2, 684 ref Vector3 b1, ref Vector3 b2,
684 ref Vector3 cp1, ref Vector3 cp2); 685 ref Vector3 cp1, ref Vector3 cp2);
685 686
686 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCloseODE"), SuppressUnmanagedCodeSecurity] 687 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCloseODE"), SuppressUnmanagedCodeSecurity]
687 public static extern void CloseODE(); 688 internal static extern void CloseODE();
688 689
689 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCollide"), SuppressUnmanagedCodeSecurity] 690 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCollide"), SuppressUnmanagedCodeSecurity]
690 public static extern int Collide(IntPtr o1, IntPtr o2, int flags, [In, Out] ContactGeom[] contact, int skip); 691 internal static extern int Collide(IntPtr o1, IntPtr o2, int flags, [In, Out] ContactGeom[] contact, int skip);
691 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCollide"), SuppressUnmanagedCodeSecurity] 692 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCollide"), SuppressUnmanagedCodeSecurity]
692 public static extern int CollidePtr(IntPtr o1, IntPtr o2, int flags, IntPtr contactgeomarray, int skip); 693 internal static extern int CollidePtr(IntPtr o1, IntPtr o2, int flags, IntPtr contactgeomarray, int skip);
693 694
694 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dConnectingJoint"), SuppressUnmanagedCodeSecurity] 695 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dConnectingJoint"), SuppressUnmanagedCodeSecurity]
695 public static extern IntPtr ConnectingJoint(IntPtr j1, IntPtr j2); 696 internal static extern IntPtr ConnectingJoint(IntPtr j1, IntPtr j2);
696 697
697 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateBox"), SuppressUnmanagedCodeSecurity] 698 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateBox"), SuppressUnmanagedCodeSecurity]
698 public static extern IntPtr CreateiBox(IntPtr space, dReal lx, dReal ly, dReal lz); 699 internal static extern IntPtr CreateiBox(IntPtr space, dReal lx, dReal ly, dReal lz);
699 public static IntPtr CreateBox(IntPtr space, dReal lx, dReal ly, dReal lz) 700 internal static IntPtr CreateBox(IntPtr space, dReal lx, dReal ly, dReal lz)
700 { 701 {
701 NTotalGeoms++; 702 NTotalGeoms++;
702 return CreateiBox(space, lx, ly, lz); 703 return CreateiBox(space, lx, ly, lz);
703 } 704 }
704 705
705 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateCapsule"), SuppressUnmanagedCodeSecurity] 706 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateCapsule"), SuppressUnmanagedCodeSecurity]
706 public static extern IntPtr CreateiCapsule(IntPtr space, dReal radius, dReal length); 707 internal static extern IntPtr CreateiCapsule(IntPtr space, dReal radius, dReal length);
707 public static IntPtr CreateCapsule(IntPtr space, dReal radius, dReal length) 708 internal static IntPtr CreateCapsule(IntPtr space, dReal radius, dReal length)
708 { 709 {
709 NTotalGeoms++; 710 NTotalGeoms++;
710 return CreateiCapsule(space, radius, length); 711 return CreateiCapsule(space, radius, length);
711 } 712 }
712 713
713 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateConvex"), SuppressUnmanagedCodeSecurity] 714 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateConvex"), SuppressUnmanagedCodeSecurity]
714 public static extern IntPtr CreateiConvex(IntPtr space, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); 715 internal static extern IntPtr CreateiConvex(IntPtr space, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons);
715 public static IntPtr CreateConvex(IntPtr space, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons) 716 internal static IntPtr CreateConvex(IntPtr space, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons)
716 { 717 {
717 NTotalGeoms++; 718 NTotalGeoms++;
718 return CreateiConvex(space, planes, planeCount, points, pointCount, polygons); 719 return CreateiConvex(space, planes, planeCount, points, pointCount, polygons);
719 } 720 }
720 721
721 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateCylinder"), SuppressUnmanagedCodeSecurity] 722 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateCylinder"), SuppressUnmanagedCodeSecurity]
722 public static extern IntPtr CreateiCylinder(IntPtr space, dReal radius, dReal length); 723 internal static extern IntPtr CreateiCylinder(IntPtr space, dReal radius, dReal length);
723 public static IntPtr CreateCylinder(IntPtr space, dReal radius, dReal length) 724 internal static IntPtr CreateCylinder(IntPtr space, dReal radius, dReal length)
724 { 725 {
725 NTotalGeoms++; 726 NTotalGeoms++;
726 return CreateiCylinder(space, radius, length); 727 return CreateiCylinder(space, radius, length);
727 } 728 }
728 729
729 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateHeightfield"), SuppressUnmanagedCodeSecurity] 730 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateHeightfield"), SuppressUnmanagedCodeSecurity]
730 public static extern IntPtr CreateiHeightfield(IntPtr space, IntPtr data, int bPlaceable); 731 internal static extern IntPtr CreateiHeightfield(IntPtr space, IntPtr data, int bPlaceable);
731 public static IntPtr CreateHeightfield(IntPtr space, IntPtr data, int bPlaceable) 732 internal static IntPtr CreateHeightfield(IntPtr space, IntPtr data, int bPlaceable)
732 { 733 {
733 NTotalGeoms++; 734 NTotalGeoms++;
734 return CreateiHeightfield(space, data, bPlaceable); 735 return CreateiHeightfield(space, data, bPlaceable);
735 } 736 }
736 737
737 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateOSTerrain"), SuppressUnmanagedCodeSecurity] 738 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateOSTerrain"), SuppressUnmanagedCodeSecurity]
738 public static extern IntPtr CreateiOSTerrain(IntPtr space, IntPtr data, int bPlaceable); 739 internal static extern IntPtr CreateiOSTerrain(IntPtr space, IntPtr data, int bPlaceable);
739 public static IntPtr CreateOSTerrain(IntPtr space, IntPtr data, int bPlaceable) 740 internal static IntPtr CreateOSTerrain(IntPtr space, IntPtr data, int bPlaceable)
740 { 741 {
741 NTotalGeoms++; 742 NTotalGeoms++;
742 return CreateiOSTerrain(space, data, bPlaceable); 743 return CreateiOSTerrain(space, data, bPlaceable);
@@ -747,127 +748,127 @@ namespace OdeAPI
747 748
748 749
749 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeom"), SuppressUnmanagedCodeSecurity] 750 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeom"), SuppressUnmanagedCodeSecurity]
750 public static extern IntPtr CreateiGeom(int classnum); 751 internal static extern IntPtr CreateiGeom(int classnum);
751 public static IntPtr CreateGeom(int classnum) 752 internal static IntPtr CreateGeom(int classnum)
752 { 753 {
753 NTotalGeoms++; 754 NTotalGeoms++;
754 return CreateiGeom(classnum); 755 return CreateiGeom(classnum);
755 } 756 }
756 757
757 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomClass"), SuppressUnmanagedCodeSecurity] 758 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomClass"), SuppressUnmanagedCodeSecurity]
758 public static extern int CreateGeomClass(ref GeomClass classptr); 759 internal static extern int CreateGeomClass(ref GeomClass classptr);
759 760
760 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomTransform"), SuppressUnmanagedCodeSecurity] 761 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomTransform"), SuppressUnmanagedCodeSecurity]
761 public static extern IntPtr CreateGeomTransform(IntPtr space); 762 internal static extern IntPtr CreateGeomTransform(IntPtr space);
762 763
763 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreatePlane"), SuppressUnmanagedCodeSecurity] 764 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreatePlane"), SuppressUnmanagedCodeSecurity]
764 public static extern IntPtr CreateiPlane(IntPtr space, dReal a, dReal b, dReal c, dReal d); 765 internal static extern IntPtr CreateiPlane(IntPtr space, dReal a, dReal b, dReal c, dReal d);
765 public static IntPtr CreatePlane(IntPtr space, dReal a, dReal b, dReal c, dReal d) 766 internal static IntPtr CreatePlane(IntPtr space, dReal a, dReal b, dReal c, dReal d)
766 { 767 {
767 NTotalGeoms++; 768 NTotalGeoms++;
768 return CreateiPlane(space, a, b, c, d); 769 return CreateiPlane(space, a, b, c, d);
769 } 770 }
770 771
771 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateRay"), SuppressUnmanagedCodeSecurity] 772 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateRay"), SuppressUnmanagedCodeSecurity]
772 public static extern IntPtr CreateiRay(IntPtr space, dReal length); 773 internal static extern IntPtr CreateiRay(IntPtr space, dReal length);
773 public static IntPtr CreateRay(IntPtr space, dReal length) 774 internal static IntPtr CreateRay(IntPtr space, dReal length)
774 { 775 {
775 NTotalGeoms++; 776 NTotalGeoms++;
776 return CreateiRay(space, length); 777 return CreateiRay(space, length);
777 } 778 }
778 779
779 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateSphere"), SuppressUnmanagedCodeSecurity] 780 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateSphere"), SuppressUnmanagedCodeSecurity]
780 public static extern IntPtr CreateiSphere(IntPtr space, dReal radius); 781 internal static extern IntPtr CreateiSphere(IntPtr space, dReal radius);
781 public static IntPtr CreateSphere(IntPtr space, dReal radius) 782 internal static IntPtr CreateSphere(IntPtr space, dReal radius)
782 { 783 {
783 NTotalGeoms++; 784 NTotalGeoms++;
784 return CreateiSphere(space, radius); 785 return CreateiSphere(space, radius);
785 } 786 }
786 787
787 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateTriMesh"), SuppressUnmanagedCodeSecurity] 788 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateTriMesh"), SuppressUnmanagedCodeSecurity]
788 public static extern IntPtr CreateiTriMesh(IntPtr space, IntPtr data, 789 internal static extern IntPtr CreateiTriMesh(IntPtr space, IntPtr data,
789 TriCallback callback, TriArrayCallback arrayCallback, TriRayCallback rayCallback); 790 TriCallback callback, TriArrayCallback arrayCallback, TriRayCallback rayCallback);
790 public static IntPtr CreateTriMesh(IntPtr space, IntPtr data, 791 internal static IntPtr CreateTriMesh(IntPtr space, IntPtr data,
791 TriCallback callback, TriArrayCallback arrayCallback, TriRayCallback rayCallback) 792 TriCallback callback, TriArrayCallback arrayCallback, TriRayCallback rayCallback)
792 { 793 {
793 NTotalGeoms++; 794 NTotalGeoms++;
794 return CreateiTriMesh(space, data, callback, arrayCallback, rayCallback); 795 return CreateiTriMesh(space, data, callback, arrayCallback, rayCallback);
795 } 796 }
796 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dDot"), SuppressUnmanagedCodeSecurity] 797 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dDot"), SuppressUnmanagedCodeSecurity]
797 public static extern dReal Dot(ref dReal X0, ref dReal X1, int n); 798 internal static extern dReal Dot(ref dReal X0, ref dReal X1, int n);
798 799
799 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dDQfromW"), SuppressUnmanagedCodeSecurity] 800 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dDQfromW"), SuppressUnmanagedCodeSecurity]
800 public static extern void DQfromW(dReal[] dq, ref Vector3 w, ref Quaternion q); 801 internal static extern void DQfromW(dReal[] dq, ref Vector3 w, ref Quaternion q);
801 802
802 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dFactorCholesky"), SuppressUnmanagedCodeSecurity] 803 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dFactorCholesky"), SuppressUnmanagedCodeSecurity]
803 public static extern int FactorCholesky(ref dReal A00, int n); 804 internal static extern int FactorCholesky(ref dReal A00, int n);
804 805
805 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dFactorLDLT"), SuppressUnmanagedCodeSecurity] 806 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dFactorLDLT"), SuppressUnmanagedCodeSecurity]
806 public static extern void FactorLDLT(ref dReal A, out dReal d, int n, int nskip); 807 internal static extern void FactorLDLT(ref dReal A, out dReal d, int n, int nskip);
807 808
808 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxGetLengths"), SuppressUnmanagedCodeSecurity] 809 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxGetLengths"), SuppressUnmanagedCodeSecurity]
809 public static extern void GeomBoxGetLengths(IntPtr geom, out Vector3 len); 810 internal static extern void GeomBoxGetLengths(IntPtr geom, out Vector3 len);
810 811
811 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxGetLengths"), SuppressUnmanagedCodeSecurity] 812 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxGetLengths"), SuppressUnmanagedCodeSecurity]
812 public static extern void GeomBoxGetLengths(IntPtr geom, out dReal x); 813 internal static extern void GeomBoxGetLengths(IntPtr geom, out dReal x);
813 814
814 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxPointDepth"), SuppressUnmanagedCodeSecurity] 815 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxPointDepth"), SuppressUnmanagedCodeSecurity]
815 public static extern dReal GeomBoxPointDepth(IntPtr geom, dReal x, dReal y, dReal z); 816 internal static extern dReal GeomBoxPointDepth(IntPtr geom, dReal x, dReal y, dReal z);
816 817
817 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxSetLengths"), SuppressUnmanagedCodeSecurity] 818 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxSetLengths"), SuppressUnmanagedCodeSecurity]
818 public static extern void GeomBoxSetLengths(IntPtr geom, dReal x, dReal y, dReal z); 819 internal static extern void GeomBoxSetLengths(IntPtr geom, dReal x, dReal y, dReal z);
819 820
820 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsuleGetParams"), SuppressUnmanagedCodeSecurity] 821 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsuleGetParams"), SuppressUnmanagedCodeSecurity]
821 public static extern void GeomCapsuleGetParams(IntPtr geom, out dReal radius, out dReal length); 822 internal static extern void GeomCapsuleGetParams(IntPtr geom, out dReal radius, out dReal length);
822 823
823 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsulePointDepth"), SuppressUnmanagedCodeSecurity] 824 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsulePointDepth"), SuppressUnmanagedCodeSecurity]
824 public static extern dReal GeomCapsulePointDepth(IntPtr geom, dReal x, dReal y, dReal z); 825 internal static extern dReal GeomCapsulePointDepth(IntPtr geom, dReal x, dReal y, dReal z);
825 826
826 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsuleSetParams"), SuppressUnmanagedCodeSecurity] 827 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsuleSetParams"), SuppressUnmanagedCodeSecurity]
827 public static extern void GeomCapsuleSetParams(IntPtr geom, dReal radius, dReal length); 828 internal static extern void GeomCapsuleSetParams(IntPtr geom, dReal radius, dReal length);
828 829
829 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomClearOffset"), SuppressUnmanagedCodeSecurity] 830 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomClearOffset"), SuppressUnmanagedCodeSecurity]
830 public static extern void GeomClearOffset(IntPtr geom); 831 internal static extern void GeomClearOffset(IntPtr geom);
831 832
832 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetPosition"), SuppressUnmanagedCodeSecurity] 833 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetPosition"), SuppressUnmanagedCodeSecurity]
833 public static extern IntPtr GeomCopyOffsetPosition(IntPtr geom, ref Vector3 pos); 834 internal static extern IntPtr GeomCopyOffsetPosition(IntPtr geom, ref Vector3 pos);
834 835
835 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetPosition"), SuppressUnmanagedCodeSecurity] 836 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetPosition"), SuppressUnmanagedCodeSecurity]
836 public static extern IntPtr GeomCopyOffsetPosition(IntPtr geom, ref dReal X); 837 internal static extern IntPtr GeomCopyOffsetPosition(IntPtr geom, ref dReal X);
837 838
838 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] 839 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetQuaternion"), SuppressUnmanagedCodeSecurity]
839 public static extern void GeomCopyOffsetQuaternion(IntPtr geom, ref Quaternion Q); 840 internal static extern void GeomCopyOffsetQuaternion(IntPtr geom, ref Quaternion Q);
840 841
841 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] 842 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetQuaternion"), SuppressUnmanagedCodeSecurity]
842 public static extern void GeomCopyOffsetQuaternion(IntPtr geom, ref dReal X); 843 internal static extern void GeomCopyOffsetQuaternion(IntPtr geom, ref dReal X);
843 844
844 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetRotation"), SuppressUnmanagedCodeSecurity] 845 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetRotation"), SuppressUnmanagedCodeSecurity]
845 public static extern IntPtr GeomCopyOffsetRotation(IntPtr geom, ref Matrix3 R); 846 internal static extern IntPtr GeomCopyOffsetRotation(IntPtr geom, ref Matrix3 R);
846 847
847 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetRotation"), SuppressUnmanagedCodeSecurity] 848 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetRotation"), SuppressUnmanagedCodeSecurity]
848 public static extern IntPtr GeomCopyOffsetRotation(IntPtr geom, ref dReal M00); 849 internal static extern IntPtr GeomCopyOffsetRotation(IntPtr geom, ref dReal M00);
849 850
850 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyPosition"), SuppressUnmanagedCodeSecurity] 851 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyPosition"), SuppressUnmanagedCodeSecurity]
851 public static extern void GeomCopyPosition(IntPtr geom, out Vector3 pos); 852 internal static extern void GeomCopyPosition(IntPtr geom, out Vector3 pos);
852 853
853 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyPosition"), SuppressUnmanagedCodeSecurity] 854 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyPosition"), SuppressUnmanagedCodeSecurity]
854 public static extern void GeomCopyPosition(IntPtr geom, out dReal X); 855 internal static extern void GeomCopyPosition(IntPtr geom, out dReal X);
855 856
856 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyRotation"), SuppressUnmanagedCodeSecurity] 857 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyRotation"), SuppressUnmanagedCodeSecurity]
857 public static extern void GeomCopyRotation(IntPtr geom, out Matrix3 R); 858 internal static extern void GeomCopyRotation(IntPtr geom, out Matrix3 R);
858 859
859 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyRotation"), SuppressUnmanagedCodeSecurity] 860 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyRotation"), SuppressUnmanagedCodeSecurity]
860 public static extern void GeomCopyRotation(IntPtr geom, out dReal M00); 861 internal static extern void GeomCopyRotation(IntPtr geom, out dReal M00);
861 862
862 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCylinderGetParams"), SuppressUnmanagedCodeSecurity] 863 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCylinderGetParams"), SuppressUnmanagedCodeSecurity]
863 public static extern void GeomCylinderGetParams(IntPtr geom, out dReal radius, out dReal length); 864 internal static extern void GeomCylinderGetParams(IntPtr geom, out dReal radius, out dReal length);
864 865
865 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCylinderSetParams"), SuppressUnmanagedCodeSecurity] 866 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCylinderSetParams"), SuppressUnmanagedCodeSecurity]
866 public static extern void GeomCylinderSetParams(IntPtr geom, dReal radius, dReal length); 867 internal static extern void GeomCylinderSetParams(IntPtr geom, dReal radius, dReal length);
867 868
868 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomDestroy"), SuppressUnmanagedCodeSecurity] 869 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomDestroy"), SuppressUnmanagedCodeSecurity]
869 public static extern void GeomiDestroy(IntPtr geom); 870 internal static extern void GeomiDestroy(IntPtr geom);
870 public static void GeomDestroy(IntPtr geom) 871 internal static void GeomDestroy(IntPtr geom)
871 { 872 {
872 NTotalGeoms--; 873 NTotalGeoms--;
873 GeomiDestroy(geom); 874 GeomiDestroy(geom);
@@ -875,64 +876,64 @@ namespace OdeAPI
875 876
876 877
877 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomDisable"), SuppressUnmanagedCodeSecurity] 878 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomDisable"), SuppressUnmanagedCodeSecurity]
878 public static extern void GeomDisable(IntPtr geom); 879 internal static extern void GeomDisable(IntPtr geom);
879 880
880 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomEnable"), SuppressUnmanagedCodeSecurity] 881 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomEnable"), SuppressUnmanagedCodeSecurity]
881 public static extern void GeomEnable(IntPtr geom); 882 internal static extern void GeomEnable(IntPtr geom);
882 883
883 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetAABB"), SuppressUnmanagedCodeSecurity] 884 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetAABB"), SuppressUnmanagedCodeSecurity]
884 public static extern void GeomGetAABB(IntPtr geom, out AABB aabb); 885 internal static extern void GeomGetAABB(IntPtr geom, out AABB aabb);
885 886
886 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetAABB"), SuppressUnmanagedCodeSecurity] 887 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetAABB"), SuppressUnmanagedCodeSecurity]
887 public static extern void GeomGetAABB(IntPtr geom, out dReal minX); 888 internal static extern void GeomGetAABB(IntPtr geom, out dReal minX);
888 889
889 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetBody"), SuppressUnmanagedCodeSecurity] 890 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetBody"), SuppressUnmanagedCodeSecurity]
890 public static extern IntPtr GeomGetBody(IntPtr geom); 891 internal static extern IntPtr GeomGetBody(IntPtr geom);
891 892
892 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetCategoryBits"), SuppressUnmanagedCodeSecurity] 893 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetCategoryBits"), SuppressUnmanagedCodeSecurity]
893 public static extern uint GeomGetCategoryBits(IntPtr geom); 894 internal static extern uint GeomGetCategoryBits(IntPtr geom);
894 895
895 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetClassData"), SuppressUnmanagedCodeSecurity] 896 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetClassData"), SuppressUnmanagedCodeSecurity]
896 public static extern IntPtr GeomGetClassData(IntPtr geom); 897 internal static extern IntPtr GeomGetClassData(IntPtr geom);
897 898
898 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetCollideBits"), SuppressUnmanagedCodeSecurity] 899 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetCollideBits"), SuppressUnmanagedCodeSecurity]
899 public static extern uint GeomGetCollideBits(IntPtr geom); 900 internal static extern uint GeomGetCollideBits(IntPtr geom);
900 901
901 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetClass"), SuppressUnmanagedCodeSecurity] 902 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetClass"), SuppressUnmanagedCodeSecurity]
902 public static extern GeomClassID GeomGetClass(IntPtr geom); 903 internal static extern GeomClassID GeomGetClass(IntPtr geom);
903 904
904 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetData"), SuppressUnmanagedCodeSecurity] 905 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetData"), SuppressUnmanagedCodeSecurity]
905 public static extern IntPtr GeomGetData(IntPtr geom); 906 internal static extern IntPtr GeomGetData(IntPtr geom);
906 907
907 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetPosition"), SuppressUnmanagedCodeSecurity] 908 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetPosition"), SuppressUnmanagedCodeSecurity]
908 public extern unsafe static Vector3* GeomGetOffsetPositionUnsafe(IntPtr geom); 909 internal extern unsafe static Vector3* GeomGetOffsetPositionUnsafe(IntPtr geom);
909 public static Vector3 GeomGetOffsetPosition(IntPtr geom) 910 internal static Vector3 GeomGetOffsetPosition(IntPtr geom)
910 { 911 {
911 unsafe { return *(GeomGetOffsetPositionUnsafe(geom)); } 912 unsafe { return *(GeomGetOffsetPositionUnsafe(geom)); }
912 } 913 }
913 914
914 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetRotation"), SuppressUnmanagedCodeSecurity] 915 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetRotation"), SuppressUnmanagedCodeSecurity]
915 public extern unsafe static Matrix3* GeomGetOffsetRotationUnsafe(IntPtr geom); 916 internal extern unsafe static Matrix3* GeomGetOffsetRotationUnsafe(IntPtr geom);
916 public static Matrix3 GeomGetOffsetRotation(IntPtr geom) 917 internal static Matrix3 GeomGetOffsetRotation(IntPtr geom)
917 { 918 {
918 unsafe { return *(GeomGetOffsetRotationUnsafe(geom)); } 919 unsafe { return *(GeomGetOffsetRotationUnsafe(geom)); }
919 } 920 }
920 921
921 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetPosition"), SuppressUnmanagedCodeSecurity] 922 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetPosition"), SuppressUnmanagedCodeSecurity]
922 public extern unsafe static Vector3* GeomGetPositionUnsafe(IntPtr geom); 923 internal extern unsafe static Vector3* GeomGetPositionUnsafe(IntPtr geom);
923 public static Vector3 GeomGetPosition(IntPtr geom) 924 internal static Vector3 GeomGetPosition(IntPtr geom)
924 { 925 {
925 unsafe { return *(GeomGetPositionUnsafe(geom)); } 926 unsafe { return *(GeomGetPositionUnsafe(geom)); }
926 } 927 }
927 public static OMV.Vector3 GeomGetPositionOMV(IntPtr geom) 928 internal static OMV.Vector3 GeomGetPositionOMV(IntPtr geom)
928 { 929 {
929 Vector3 vtmp = GeomGetPosition(geom); 930 Vector3 vtmp = GeomGetPosition(geom);
930 return new OMV.Vector3(vtmp.X, vtmp.Y, vtmp.Z); 931 return new OMV.Vector3(vtmp.X, vtmp.Y, vtmp.Z);
931 } 932 }
932 933
933 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity] 934 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity]
934 public static extern void GeomCopyQuaternion(IntPtr geom, out Quaternion q); 935 internal static extern void GeomCopyQuaternion(IntPtr geom, out Quaternion q);
935 public static OMV.Quaternion GeomGetQuaternionOMV(IntPtr geom) 936 internal static OMV.Quaternion GeomGetQuaternionOMV(IntPtr geom)
936 { 937 {
937 Quaternion qtmp; 938 Quaternion qtmp;
938 GeomCopyQuaternion(geom, out qtmp); 939 GeomCopyQuaternion(geom, out qtmp);
@@ -940,393 +941,393 @@ namespace OdeAPI
940 } 941 }
941 942
942 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity] 943 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity]
943 public static extern void GeomCopyQuaternion(IntPtr geom, out dReal X); 944 internal static extern void GeomCopyQuaternion(IntPtr geom, out dReal X);
944 945
945 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetRotation"), SuppressUnmanagedCodeSecurity] 946 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetRotation"), SuppressUnmanagedCodeSecurity]
946 public extern unsafe static Matrix3* GeomGetRotationUnsafe(IntPtr geom); 947 internal extern unsafe static Matrix3* GeomGetRotationUnsafe(IntPtr geom);
947 public static Matrix3 GeomGetRotation(IntPtr geom) 948 internal static Matrix3 GeomGetRotation(IntPtr geom)
948 { 949 {
949 unsafe { return *(GeomGetRotationUnsafe(geom)); } 950 unsafe { return *(GeomGetRotationUnsafe(geom)); }
950 } 951 }
951 952
952 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetSpace"), SuppressUnmanagedCodeSecurity] 953 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetSpace"), SuppressUnmanagedCodeSecurity]
953 public static extern IntPtr GeomGetSpace(IntPtr geom); 954 internal static extern IntPtr GeomGetSpace(IntPtr geom);
954 955
955 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildByte"), SuppressUnmanagedCodeSecurity] 956 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildByte"), SuppressUnmanagedCodeSecurity]
956 public static extern void GeomHeightfieldDataBuildByte(IntPtr d, byte[] pHeightData, int bCopyHeightData, 957 internal static extern void GeomHeightfieldDataBuildByte(IntPtr d, byte[] pHeightData, int bCopyHeightData,
957 dReal width, dReal depth, int widthSamples, int depthSamples, 958 dReal width, dReal depth, int widthSamples, int depthSamples,
958 dReal scale, dReal offset, dReal thickness, int bWrap); 959 dReal scale, dReal offset, dReal thickness, int bWrap);
959 960
960 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildByte"), SuppressUnmanagedCodeSecurity] 961 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildByte"), SuppressUnmanagedCodeSecurity]
961 public static extern void GeomHeightfieldDataBuildByte(IntPtr d, IntPtr pHeightData, int bCopyHeightData, 962 internal static extern void GeomHeightfieldDataBuildByte(IntPtr d, IntPtr pHeightData, int bCopyHeightData,
962 dReal width, dReal depth, int widthSamples, int depthSamples, 963 dReal width, dReal depth, int widthSamples, int depthSamples,
963 dReal scale, dReal offset, dReal thickness, int bWrap); 964 dReal scale, dReal offset, dReal thickness, int bWrap);
964 965
965 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildCallback"), SuppressUnmanagedCodeSecurity] 966 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildCallback"), SuppressUnmanagedCodeSecurity]
966 public static extern void GeomHeightfieldDataBuildCallback(IntPtr d, IntPtr pUserData, HeightfieldGetHeight pCallback, 967 internal static extern void GeomHeightfieldDataBuildCallback(IntPtr d, IntPtr pUserData, HeightfieldGetHeight pCallback,
967 dReal width, dReal depth, int widthSamples, int depthSamples, 968 dReal width, dReal depth, int widthSamples, int depthSamples,
968 dReal scale, dReal offset, dReal thickness, int bWrap); 969 dReal scale, dReal offset, dReal thickness, int bWrap);
969 970
970 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity] 971 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity]
971 public static extern void GeomHeightfieldDataBuildShort(IntPtr d, ushort[] pHeightData, int bCopyHeightData, 972 internal static extern void GeomHeightfieldDataBuildShort(IntPtr d, ushort[] pHeightData, int bCopyHeightData,
972 dReal width, dReal depth, int widthSamples, int depthSamples, 973 dReal width, dReal depth, int widthSamples, int depthSamples,
973 dReal scale, dReal offset, dReal thickness, int bWrap); 974 dReal scale, dReal offset, dReal thickness, int bWrap);
974 975
975 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity] 976 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity]
976 public static extern void GeomHeightfieldDataBuildShort(IntPtr d, short[] pHeightData, int bCopyHeightData, 977 internal static extern void GeomHeightfieldDataBuildShort(IntPtr d, short[] pHeightData, int bCopyHeightData,
977 dReal width, dReal depth, int widthSamples, int depthSamples, 978 dReal width, dReal depth, int widthSamples, int depthSamples,
978 dReal scale, dReal offset, dReal thickness, int bWrap); 979 dReal scale, dReal offset, dReal thickness, int bWrap);
979 980
980 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity] 981 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity]
981 public static extern void GeomHeightfieldDataBuildShort(IntPtr d, IntPtr pHeightData, int bCopyHeightData, 982 internal static extern void GeomHeightfieldDataBuildShort(IntPtr d, IntPtr pHeightData, int bCopyHeightData,
982 dReal width, dReal depth, int widthSamples, int depthSamples, 983 dReal width, dReal depth, int widthSamples, int depthSamples,
983 dReal scale, dReal offset, dReal thickness, int bWrap); 984 dReal scale, dReal offset, dReal thickness, int bWrap);
984 985
985 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildSingle"), SuppressUnmanagedCodeSecurity] 986 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildSingle"), SuppressUnmanagedCodeSecurity]
986 public static extern void GeomHeightfieldDataBuildSingle(IntPtr d, float[] pHeightData, int bCopyHeightData, 987 internal static extern void GeomHeightfieldDataBuildSingle(IntPtr d, float[] pHeightData, int bCopyHeightData,
987 dReal width, dReal depth, int widthSamples, int depthSamples, 988 dReal width, dReal depth, int widthSamples, int depthSamples,
988 dReal scale, dReal offset, dReal thickness, int bWrap); 989 dReal scale, dReal offset, dReal thickness, int bWrap);
989 990
990 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildSingle"), SuppressUnmanagedCodeSecurity] 991 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildSingle"), SuppressUnmanagedCodeSecurity]
991 public static extern void GeomHeightfieldDataBuildSingle(IntPtr d, IntPtr pHeightData, int bCopyHeightData, 992 internal static extern void GeomHeightfieldDataBuildSingle(IntPtr d, IntPtr pHeightData, int bCopyHeightData,
992 dReal width, dReal depth, int widthSamples, int depthSamples, 993 dReal width, dReal depth, int widthSamples, int depthSamples,
993 dReal scale, dReal offset, dReal thickness, int bWrap); 994 dReal scale, dReal offset, dReal thickness, int bWrap);
994 995
995 996
996 997
997 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildDouble"), SuppressUnmanagedCodeSecurity] 998 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildDouble"), SuppressUnmanagedCodeSecurity]
998 public static extern void GeomHeightfieldDataBuildDouble(IntPtr d, double[] pHeightData, int bCopyHeightData, 999 internal static extern void GeomHeightfieldDataBuildDouble(IntPtr d, double[] pHeightData, int bCopyHeightData,
999 dReal width, dReal depth, int widthSamples, int depthSamples, 1000 dReal width, dReal depth, int widthSamples, int depthSamples,
1000 dReal scale, dReal offset, dReal thickness, int bWrap); 1001 dReal scale, dReal offset, dReal thickness, int bWrap);
1001 1002
1002 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildDouble"), SuppressUnmanagedCodeSecurity] 1003 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildDouble"), SuppressUnmanagedCodeSecurity]
1003 public static extern void GeomHeightfieldDataBuildDouble(IntPtr d, IntPtr pHeightData, int bCopyHeightData, 1004 internal static extern void GeomHeightfieldDataBuildDouble(IntPtr d, IntPtr pHeightData, int bCopyHeightData,
1004 dReal width, dReal depth, int widthSamples, int depthSamples, 1005 dReal width, dReal depth, int widthSamples, int depthSamples,
1005 dReal scale, dReal offset, dReal thickness, int bWrap); 1006 dReal scale, dReal offset, dReal thickness, int bWrap);
1006 1007
1007 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataCreate"), SuppressUnmanagedCodeSecurity] 1008 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataCreate"), SuppressUnmanagedCodeSecurity]
1008 public static extern IntPtr GeomHeightfieldDataCreate(); 1009 internal static extern IntPtr GeomHeightfieldDataCreate();
1009 1010
1010 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataDestroy"), SuppressUnmanagedCodeSecurity] 1011 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataDestroy"), SuppressUnmanagedCodeSecurity]
1011 public static extern void GeomHeightfieldDataDestroy(IntPtr d); 1012 internal static extern void GeomHeightfieldDataDestroy(IntPtr d);
1012 1013
1013 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataSetBounds"), SuppressUnmanagedCodeSecurity] 1014 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataSetBounds"), SuppressUnmanagedCodeSecurity]
1014 public static extern void GeomHeightfieldDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight); 1015 internal static extern void GeomHeightfieldDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight);
1015 1016
1016 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldGetHeightfieldData"), SuppressUnmanagedCodeSecurity] 1017 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldGetHeightfieldData"), SuppressUnmanagedCodeSecurity]
1017 public static extern IntPtr GeomHeightfieldGetHeightfieldData(IntPtr g); 1018 internal static extern IntPtr GeomHeightfieldGetHeightfieldData(IntPtr g);
1018 1019
1019 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldSetHeightfieldData"), SuppressUnmanagedCodeSecurity] 1020 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldSetHeightfieldData"), SuppressUnmanagedCodeSecurity]
1020 public static extern void GeomHeightfieldSetHeightfieldData(IntPtr g, IntPtr d); 1021 internal static extern void GeomHeightfieldSetHeightfieldData(IntPtr g, IntPtr d);
1021 1022
1022 1023
1023 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomUbitTerrainDataBuild"), SuppressUnmanagedCodeSecurity] 1024 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomUbitTerrainDataBuild"), SuppressUnmanagedCodeSecurity]
1024 public static extern void GeomOSTerrainDataBuild(IntPtr d, float[] pHeightData, int bCopyHeightData, 1025 internal static extern void GeomOSTerrainDataBuild(IntPtr d, float[] pHeightData, int bCopyHeightData,
1025 dReal sampleSize, int widthSamples, int depthSamples, 1026 dReal sampleSize, int widthSamples, int depthSamples,
1026 dReal offset, dReal thickness, int bWrap); 1027 dReal offset, dReal thickness, int bWrap);
1027 1028
1028 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataBuild"), SuppressUnmanagedCodeSecurity] 1029 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataBuild"), SuppressUnmanagedCodeSecurity]
1029 public static extern void GeomOSTerrainDataBuild(IntPtr d, IntPtr pHeightData, int bCopyHeightData, 1030 internal static extern void GeomOSTerrainDataBuild(IntPtr d, IntPtr pHeightData, int bCopyHeightData,
1030 dReal sampleSize, int widthSamples, int depthSamples, 1031 dReal sampleSize, int widthSamples, int depthSamples,
1031 dReal thickness, int bWrap); 1032 dReal thickness, int bWrap);
1032 1033
1033 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataCreate"), SuppressUnmanagedCodeSecurity] 1034 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataCreate"), SuppressUnmanagedCodeSecurity]
1034 public static extern IntPtr GeomOSTerrainDataCreate(); 1035 internal static extern IntPtr GeomOSTerrainDataCreate();
1035 1036
1036 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataDestroy"), SuppressUnmanagedCodeSecurity] 1037 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataDestroy"), SuppressUnmanagedCodeSecurity]
1037 public static extern void GeomOSTerrainDataDestroy(IntPtr d); 1038 internal static extern void GeomOSTerrainDataDestroy(IntPtr d);
1038 1039
1039 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataSetBounds"), SuppressUnmanagedCodeSecurity] 1040 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataSetBounds"), SuppressUnmanagedCodeSecurity]
1040 public static extern void GeomOSTerrainDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight); 1041 internal static extern void GeomOSTerrainDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight);
1041 1042
1042 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainGetHeightfieldData"), SuppressUnmanagedCodeSecurity] 1043 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainGetHeightfieldData"), SuppressUnmanagedCodeSecurity]
1043 public static extern IntPtr GeomOSTerrainGetHeightfieldData(IntPtr g); 1044 internal static extern IntPtr GeomOSTerrainGetHeightfieldData(IntPtr g);
1044 1045
1045 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainSetHeightfieldData"), SuppressUnmanagedCodeSecurity] 1046 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainSetHeightfieldData"), SuppressUnmanagedCodeSecurity]
1046 public static extern void GeomOSTerrainSetHeightfieldData(IntPtr g, IntPtr d); 1047 internal static extern void GeomOSTerrainSetHeightfieldData(IntPtr g, IntPtr d);
1047 1048
1048 1049
1049 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsEnabled"), SuppressUnmanagedCodeSecurity] 1050 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsEnabled"), SuppressUnmanagedCodeSecurity]
1050 public static extern bool GeomIsEnabled(IntPtr geom); 1051 internal static extern bool GeomIsEnabled(IntPtr geom);
1051 1052
1052 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsOffset"), SuppressUnmanagedCodeSecurity] 1053 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsOffset"), SuppressUnmanagedCodeSecurity]
1053 public static extern bool GeomIsOffset(IntPtr geom); 1054 internal static extern bool GeomIsOffset(IntPtr geom);
1054 1055
1055 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsSpace"), SuppressUnmanagedCodeSecurity] 1056 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsSpace"), SuppressUnmanagedCodeSecurity]
1056 public static extern bool GeomIsSpace(IntPtr geom); 1057 internal static extern bool GeomIsSpace(IntPtr geom);
1057 1058
1058 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneGetParams"), SuppressUnmanagedCodeSecurity] 1059 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneGetParams"), SuppressUnmanagedCodeSecurity]
1059 public static extern void GeomPlaneGetParams(IntPtr geom, ref Vector4 result); 1060 internal static extern void GeomPlaneGetParams(IntPtr geom, ref Vector4 result);
1060 1061
1061 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneGetParams"), SuppressUnmanagedCodeSecurity] 1062 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneGetParams"), SuppressUnmanagedCodeSecurity]
1062 public static extern void GeomPlaneGetParams(IntPtr geom, ref dReal A); 1063 internal static extern void GeomPlaneGetParams(IntPtr geom, ref dReal A);
1063 1064
1064 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlanePointDepth"), SuppressUnmanagedCodeSecurity] 1065 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlanePointDepth"), SuppressUnmanagedCodeSecurity]
1065 public static extern dReal GeomPlanePointDepth(IntPtr geom, dReal x, dReal y, dReal z); 1066 internal static extern dReal GeomPlanePointDepth(IntPtr geom, dReal x, dReal y, dReal z);
1066 1067
1067 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneSetParams"), SuppressUnmanagedCodeSecurity] 1068 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneSetParams"), SuppressUnmanagedCodeSecurity]
1068 public static extern void GeomPlaneSetParams(IntPtr plane, dReal a, dReal b, dReal c, dReal d); 1069 internal static extern void GeomPlaneSetParams(IntPtr plane, dReal a, dReal b, dReal c, dReal d);
1069 1070
1070 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGet"), SuppressUnmanagedCodeSecurity] 1071 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGet"), SuppressUnmanagedCodeSecurity]
1071 public static extern void GeomRayGet(IntPtr ray, ref Vector3 start, ref Vector3 dir); 1072 internal static extern void GeomRayGet(IntPtr ray, ref Vector3 start, ref Vector3 dir);
1072 1073
1073 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGet"), SuppressUnmanagedCodeSecurity] 1074 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGet"), SuppressUnmanagedCodeSecurity]
1074 public static extern void GeomRayGet(IntPtr ray, ref dReal startX, ref dReal dirX); 1075 internal static extern void GeomRayGet(IntPtr ray, ref dReal startX, ref dReal dirX);
1075 1076
1076 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetClosestHit"), SuppressUnmanagedCodeSecurity] 1077 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetClosestHit"), SuppressUnmanagedCodeSecurity]
1077 public static extern int GeomRayGetClosestHit(IntPtr ray); 1078 internal static extern int GeomRayGetClosestHit(IntPtr ray);
1078 1079
1079 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetLength"), SuppressUnmanagedCodeSecurity] 1080 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetLength"), SuppressUnmanagedCodeSecurity]
1080 public static extern dReal GeomRayGetLength(IntPtr ray); 1081 internal static extern dReal GeomRayGetLength(IntPtr ray);
1081 1082
1082 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetParams"), SuppressUnmanagedCodeSecurity] 1083 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetParams"), SuppressUnmanagedCodeSecurity]
1083 public static extern dReal GeomRayGetParams(IntPtr g, out int firstContact, out int backfaceCull); 1084 internal static extern dReal GeomRayGetParams(IntPtr g, out int firstContact, out int backfaceCull);
1084 1085
1085 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySet"), SuppressUnmanagedCodeSecurity] 1086 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySet"), SuppressUnmanagedCodeSecurity]
1086 public static extern void GeomRaySet(IntPtr ray, dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz); 1087 internal static extern void GeomRaySet(IntPtr ray, dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz);
1087 1088
1088 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetClosestHit"), SuppressUnmanagedCodeSecurity] 1089 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetClosestHit"), SuppressUnmanagedCodeSecurity]
1089 public static extern void GeomRaySetClosestHit(IntPtr ray, int closestHit); 1090 internal static extern void GeomRaySetClosestHit(IntPtr ray, int closestHit);
1090 1091
1091 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetLength"), SuppressUnmanagedCodeSecurity] 1092 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetLength"), SuppressUnmanagedCodeSecurity]
1092 public static extern void GeomRaySetLength(IntPtr ray, dReal length); 1093 internal static extern void GeomRaySetLength(IntPtr ray, dReal length);
1093 1094
1094 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetParams"), SuppressUnmanagedCodeSecurity] 1095 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetParams"), SuppressUnmanagedCodeSecurity]
1095 public static extern void GeomRaySetParams(IntPtr ray, int firstContact, int backfaceCull); 1096 internal static extern void GeomRaySetParams(IntPtr ray, int firstContact, int backfaceCull);
1096 1097
1097 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetBody"), SuppressUnmanagedCodeSecurity] 1098 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetBody"), SuppressUnmanagedCodeSecurity]
1098 public static extern void GeomSetBody(IntPtr geom, IntPtr body); 1099 internal static extern void GeomSetBody(IntPtr geom, IntPtr body);
1099 1100
1100 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetCategoryBits"), SuppressUnmanagedCodeSecurity] 1101 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetCategoryBits"), SuppressUnmanagedCodeSecurity]
1101 public static extern void GeomSetCategoryBits(IntPtr geom, uint bits); 1102 internal static extern void GeomSetCategoryBits(IntPtr geom, uint bits);
1102 1103
1103 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetCollideBits"), SuppressUnmanagedCodeSecurity] 1104 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetCollideBits"), SuppressUnmanagedCodeSecurity]
1104 public static extern void GeomSetCollideBits(IntPtr geom, uint bits); 1105 internal static extern void GeomSetCollideBits(IntPtr geom, uint bits);
1105 1106
1106 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetConvex"), SuppressUnmanagedCodeSecurity] 1107 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetConvex"), SuppressUnmanagedCodeSecurity]
1107 public static extern IntPtr GeomSetConvex(IntPtr geom, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); 1108 internal static extern IntPtr GeomSetConvex(IntPtr geom, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons);
1108 1109
1109 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetData"), SuppressUnmanagedCodeSecurity] 1110 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetData"), SuppressUnmanagedCodeSecurity]
1110 public static extern void GeomSetData(IntPtr geom, IntPtr data); 1111 internal static extern void GeomSetData(IntPtr geom, IntPtr data);
1111 1112
1112 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetPosition"), SuppressUnmanagedCodeSecurity] 1113 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetPosition"), SuppressUnmanagedCodeSecurity]
1113 public static extern void GeomSetOffsetPosition(IntPtr geom, dReal x, dReal y, dReal z); 1114 internal static extern void GeomSetOffsetPosition(IntPtr geom, dReal x, dReal y, dReal z);
1114 1115
1115 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] 1116 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetQuaternion"), SuppressUnmanagedCodeSecurity]
1116 public static extern void GeomSetOffsetQuaternion(IntPtr geom, ref Quaternion Q); 1117 internal static extern void GeomSetOffsetQuaternion(IntPtr geom, ref Quaternion Q);
1117 1118
1118 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] 1119 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetQuaternion"), SuppressUnmanagedCodeSecurity]
1119 public static extern void GeomSetOffsetQuaternion(IntPtr geom, ref dReal X); 1120 internal static extern void GeomSetOffsetQuaternion(IntPtr geom, ref dReal X);
1120 1121
1121 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetRotation"), SuppressUnmanagedCodeSecurity] 1122 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetRotation"), SuppressUnmanagedCodeSecurity]
1122 public static extern void GeomSetOffsetRotation(IntPtr geom, ref Matrix3 R); 1123 internal static extern void GeomSetOffsetRotation(IntPtr geom, ref Matrix3 R);
1123 1124
1124 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetRotation"), SuppressUnmanagedCodeSecurity] 1125 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetRotation"), SuppressUnmanagedCodeSecurity]
1125 public static extern void GeomSetOffsetRotation(IntPtr geom, ref dReal M00); 1126 internal static extern void GeomSetOffsetRotation(IntPtr geom, ref dReal M00);
1126 1127
1127 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldPosition"), SuppressUnmanagedCodeSecurity] 1128 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldPosition"), SuppressUnmanagedCodeSecurity]
1128 public static extern void GeomSetOffsetWorldPosition(IntPtr geom, dReal x, dReal y, dReal z); 1129 internal static extern void GeomSetOffsetWorldPosition(IntPtr geom, dReal x, dReal y, dReal z);
1129 1130
1130 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldQuaternion"), SuppressUnmanagedCodeSecurity] 1131 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldQuaternion"), SuppressUnmanagedCodeSecurity]
1131 public static extern void GeomSetOffsetWorldQuaternion(IntPtr geom, ref Quaternion Q); 1132 internal static extern void GeomSetOffsetWorldQuaternion(IntPtr geom, ref Quaternion Q);
1132 1133
1133 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldQuaternion"), SuppressUnmanagedCodeSecurity] 1134 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldQuaternion"), SuppressUnmanagedCodeSecurity]
1134 public static extern void GeomSetOffsetWorldQuaternion(IntPtr geom, ref dReal X); 1135 internal static extern void GeomSetOffsetWorldQuaternion(IntPtr geom, ref dReal X);
1135 1136
1136 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldRotation"), SuppressUnmanagedCodeSecurity] 1137 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldRotation"), SuppressUnmanagedCodeSecurity]
1137 public static extern void GeomSetOffsetWorldRotation(IntPtr geom, ref Matrix3 R); 1138 internal static extern void GeomSetOffsetWorldRotation(IntPtr geom, ref Matrix3 R);
1138 1139
1139 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldRotation"), SuppressUnmanagedCodeSecurity] 1140 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldRotation"), SuppressUnmanagedCodeSecurity]
1140 public static extern void GeomSetOffsetWorldRotation(IntPtr geom, ref dReal M00); 1141 internal static extern void GeomSetOffsetWorldRotation(IntPtr geom, ref dReal M00);
1141 1142
1142 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetPosition"), SuppressUnmanagedCodeSecurity] 1143 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetPosition"), SuppressUnmanagedCodeSecurity]
1143 public static extern void GeomSetPosition(IntPtr geom, dReal x, dReal y, dReal z); 1144 internal static extern void GeomSetPosition(IntPtr geom, dReal x, dReal y, dReal z);
1144 1145
1145 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetQuaternion"), SuppressUnmanagedCodeSecurity] 1146 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetQuaternion"), SuppressUnmanagedCodeSecurity]
1146 public static extern void GeomSetQuaternion(IntPtr geom, ref Quaternion quat); 1147 internal static extern void GeomSetQuaternion(IntPtr geom, ref Quaternion quat);
1147 1148
1148 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetQuaternion"), SuppressUnmanagedCodeSecurity] 1149 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetQuaternion"), SuppressUnmanagedCodeSecurity]
1149 public static extern void GeomSetQuaternion(IntPtr geom, ref dReal w); 1150 internal static extern void GeomSetQuaternion(IntPtr geom, ref dReal w);
1150 1151
1151 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetRotation"), SuppressUnmanagedCodeSecurity] 1152 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetRotation"), SuppressUnmanagedCodeSecurity]
1152 public static extern void GeomSetRotation(IntPtr geom, ref Matrix3 R); 1153 internal static extern void GeomSetRotation(IntPtr geom, ref Matrix3 R);
1153 1154
1154 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetRotation"), SuppressUnmanagedCodeSecurity] 1155 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetRotation"), SuppressUnmanagedCodeSecurity]
1155 public static extern void GeomSetRotation(IntPtr geom, ref dReal M00); 1156 internal static extern void GeomSetRotation(IntPtr geom, ref dReal M00);
1156 1157
1157 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSphereGetRadius"), SuppressUnmanagedCodeSecurity] 1158 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSphereGetRadius"), SuppressUnmanagedCodeSecurity]
1158 public static extern dReal GeomSphereGetRadius(IntPtr geom); 1159 internal static extern dReal GeomSphereGetRadius(IntPtr geom);
1159 1160
1160 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSpherePointDepth"), SuppressUnmanagedCodeSecurity] 1161 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSpherePointDepth"), SuppressUnmanagedCodeSecurity]
1161 public static extern dReal GeomSpherePointDepth(IntPtr geom, dReal x, dReal y, dReal z); 1162 internal static extern dReal GeomSpherePointDepth(IntPtr geom, dReal x, dReal y, dReal z);
1162 1163
1163 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSphereSetRadius"), SuppressUnmanagedCodeSecurity] 1164 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSphereSetRadius"), SuppressUnmanagedCodeSecurity]
1164 public static extern void GeomSphereSetRadius(IntPtr geom, dReal radius); 1165 internal static extern void GeomSphereSetRadius(IntPtr geom, dReal radius);
1165 1166
1166 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetCleanup"), SuppressUnmanagedCodeSecurity] 1167 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetCleanup"), SuppressUnmanagedCodeSecurity]
1167 public static extern int GeomTransformGetCleanup(IntPtr geom); 1168 internal static extern int GeomTransformGetCleanup(IntPtr geom);
1168 1169
1169 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetGeom"), SuppressUnmanagedCodeSecurity] 1170 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetGeom"), SuppressUnmanagedCodeSecurity]
1170 public static extern IntPtr GeomTransformGetGeom(IntPtr geom); 1171 internal static extern IntPtr GeomTransformGetGeom(IntPtr geom);
1171 1172
1172 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetInfo"), SuppressUnmanagedCodeSecurity] 1173 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetInfo"), SuppressUnmanagedCodeSecurity]
1173 public static extern int GeomTransformGetInfo(IntPtr geom); 1174 internal static extern int GeomTransformGetInfo(IntPtr geom);
1174 1175
1175 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetCleanup"), SuppressUnmanagedCodeSecurity] 1176 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetCleanup"), SuppressUnmanagedCodeSecurity]
1176 public static extern void GeomTransformSetCleanup(IntPtr geom, int mode); 1177 internal static extern void GeomTransformSetCleanup(IntPtr geom, int mode);
1177 1178
1178 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetGeom"), SuppressUnmanagedCodeSecurity] 1179 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetGeom"), SuppressUnmanagedCodeSecurity]
1179 public static extern void GeomTransformSetGeom(IntPtr geom, IntPtr obj); 1180 internal static extern void GeomTransformSetGeom(IntPtr geom, IntPtr obj);
1180 1181
1181 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetInfo"), SuppressUnmanagedCodeSecurity] 1182 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetInfo"), SuppressUnmanagedCodeSecurity]
1182 public static extern void GeomTransformSetInfo(IntPtr geom, int info); 1183 internal static extern void GeomTransformSetInfo(IntPtr geom, int info);
1183 1184
1184 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble"), SuppressUnmanagedCodeSecurity] 1185 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble"), SuppressUnmanagedCodeSecurity]
1185 public static extern void GeomTriMeshDataBuildDouble(IntPtr d, 1186 internal static extern void GeomTriMeshDataBuildDouble(IntPtr d,
1186 double[] vertices, int vertexStride, int vertexCount, 1187 double[] vertices, int vertexStride, int vertexCount,
1187 int[] indices, int indexCount, int triStride); 1188 int[] indices, int indexCount, int triStride);
1188 1189
1189 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble"), SuppressUnmanagedCodeSecurity] 1190 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble"), SuppressUnmanagedCodeSecurity]
1190 public static extern void GeomTriMeshDataBuildDouble(IntPtr d, 1191 internal static extern void GeomTriMeshDataBuildDouble(IntPtr d,
1191 IntPtr vertices, int vertexStride, int vertexCount, 1192 IntPtr vertices, int vertexStride, int vertexCount,
1192 IntPtr indices, int indexCount, int triStride); 1193 IntPtr indices, int indexCount, int triStride);
1193 1194
1194 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble1"), SuppressUnmanagedCodeSecurity] 1195 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble1"), SuppressUnmanagedCodeSecurity]
1195 public static extern void GeomTriMeshDataBuildDouble1(IntPtr d, 1196 internal static extern void GeomTriMeshDataBuildDouble1(IntPtr d,
1196 double[] vertices, int vertexStride, int vertexCount, 1197 double[] vertices, int vertexStride, int vertexCount,
1197 int[] indices, int indexCount, int triStride, 1198 int[] indices, int indexCount, int triStride,
1198 double[] normals); 1199 double[] normals);
1199 1200
1200 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble1"), SuppressUnmanagedCodeSecurity] 1201 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble1"), SuppressUnmanagedCodeSecurity]
1201 public static extern void GeomTriMeshDataBuildDouble(IntPtr d, 1202 internal static extern void GeomTriMeshDataBuildDouble(IntPtr d,
1202 IntPtr vertices, int vertexStride, int vertexCount, 1203 IntPtr vertices, int vertexStride, int vertexCount,
1203 IntPtr indices, int indexCount, int triStride, 1204 IntPtr indices, int indexCount, int triStride,
1204 IntPtr normals); 1205 IntPtr normals);
1205 1206
1206 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple"), SuppressUnmanagedCodeSecurity] 1207 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple"), SuppressUnmanagedCodeSecurity]
1207 public static extern void GeomTriMeshDataBuildSingle(IntPtr d, 1208 internal static extern void GeomTriMeshDataBuildSingle(IntPtr d,
1208 dReal[] vertices, int vertexStride, int vertexCount, 1209 dReal[] vertices, int vertexStride, int vertexCount,
1209 int[] indices, int indexCount, int triStride); 1210 int[] indices, int indexCount, int triStride);
1210 1211
1211 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple"), SuppressUnmanagedCodeSecurity] 1212 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple"), SuppressUnmanagedCodeSecurity]
1212 public static extern void GeomTriMeshDataBuildSingle(IntPtr d, 1213 internal static extern void GeomTriMeshDataBuildSingle(IntPtr d,
1213 IntPtr vertices, int vertexStride, int vertexCount, 1214 IntPtr vertices, int vertexStride, int vertexCount,
1214 IntPtr indices, int indexCount, int triStride); 1215 IntPtr indices, int indexCount, int triStride);
1215 1216
1216 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple1"), SuppressUnmanagedCodeSecurity] 1217 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple1"), SuppressUnmanagedCodeSecurity]
1217 public static extern void GeomTriMeshDataBuildSingle1(IntPtr d, 1218 internal static extern void GeomTriMeshDataBuildSingle1(IntPtr d,
1218 dReal[] vertices, int vertexStride, int vertexCount, 1219 dReal[] vertices, int vertexStride, int vertexCount,
1219 int[] indices, int indexCount, int triStride, 1220 int[] indices, int indexCount, int triStride,
1220 dReal[] normals); 1221 dReal[] normals);
1221 1222
1222 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple1"), SuppressUnmanagedCodeSecurity] 1223 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple1"), SuppressUnmanagedCodeSecurity]
1223 public static extern void GeomTriMeshDataBuildSingle1(IntPtr d, 1224 internal static extern void GeomTriMeshDataBuildSingle1(IntPtr d,
1224 IntPtr vertices, int vertexStride, int vertexCount, 1225 IntPtr vertices, int vertexStride, int vertexCount,
1225 IntPtr indices, int indexCount, int triStride, 1226 IntPtr indices, int indexCount, int triStride,
1226 IntPtr normals); 1227 IntPtr normals);
1227 1228
1228 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle"), SuppressUnmanagedCodeSecurity] 1229 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle"), SuppressUnmanagedCodeSecurity]
1229 public static extern void GeomTriMeshDataBuildSimple(IntPtr d, 1230 internal static extern void GeomTriMeshDataBuildSimple(IntPtr d,
1230 float[] vertices, int vertexStride, int vertexCount, 1231 float[] vertices, int vertexStride, int vertexCount,
1231 int[] indices, int indexCount, int triStride); 1232 int[] indices, int indexCount, int triStride);
1232 1233
1233 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle"), SuppressUnmanagedCodeSecurity] 1234 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle"), SuppressUnmanagedCodeSecurity]
1234 public static extern void GeomTriMeshDataBuildSimple(IntPtr d, 1235 internal static extern void GeomTriMeshDataBuildSimple(IntPtr d,
1235 IntPtr vertices, int vertexStride, int vertexCount, 1236 IntPtr vertices, int vertexStride, int vertexCount,
1236 IntPtr indices, int indexCount, int triStride); 1237 IntPtr indices, int indexCount, int triStride);
1237 1238
1238 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle1"), SuppressUnmanagedCodeSecurity] 1239 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle1"), SuppressUnmanagedCodeSecurity]
1239 public static extern void GeomTriMeshDataBuildSimple1(IntPtr d, 1240 internal static extern void GeomTriMeshDataBuildSimple1(IntPtr d,
1240 float[] vertices, int vertexStride, int vertexCount, 1241 float[] vertices, int vertexStride, int vertexCount,
1241 int[] indices, int indexCount, int triStride, 1242 int[] indices, int indexCount, int triStride,
1242 float[] normals); 1243 float[] normals);
1243 1244
1244 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle1"), SuppressUnmanagedCodeSecurity] 1245 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle1"), SuppressUnmanagedCodeSecurity]
1245 public static extern void GeomTriMeshDataBuildSimple1(IntPtr d, 1246 internal static extern void GeomTriMeshDataBuildSimple1(IntPtr d,
1246 IntPtr vertices, int vertexStride, int vertexCount, 1247 IntPtr vertices, int vertexStride, int vertexCount,
1247 IntPtr indices, int indexCount, int triStride, 1248 IntPtr indices, int indexCount, int triStride,
1248 IntPtr normals); 1249 IntPtr normals);
1249 1250
1250 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshClearTCCache"), SuppressUnmanagedCodeSecurity] 1251 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshClearTCCache"), SuppressUnmanagedCodeSecurity]
1251 public static extern void GeomTriMeshClearTCCache(IntPtr g); 1252 internal static extern void GeomTriMeshClearTCCache(IntPtr g);
1252 1253
1253 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataCreate"), SuppressUnmanagedCodeSecurity] 1254 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataCreate"), SuppressUnmanagedCodeSecurity]
1254 public static extern IntPtr GeomTriMeshDataCreate(); 1255 internal static extern IntPtr GeomTriMeshDataCreate();
1255 1256
1256 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataDestroy"), SuppressUnmanagedCodeSecurity] 1257 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataDestroy"), SuppressUnmanagedCodeSecurity]
1257 public static extern void GeomTriMeshDataDestroy(IntPtr d); 1258 internal static extern void GeomTriMeshDataDestroy(IntPtr d);
1258 1259
1259 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataGet"), SuppressUnmanagedCodeSecurity] 1260 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataGet"), SuppressUnmanagedCodeSecurity]
1260 public static extern IntPtr GeomTriMeshDataGet(IntPtr d, int data_id); 1261 internal static extern IntPtr GeomTriMeshDataGet(IntPtr d, int data_id);
1261 1262
1262 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataPreprocess"), SuppressUnmanagedCodeSecurity] 1263 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataPreprocess"), SuppressUnmanagedCodeSecurity]
1263 public static extern void GeomTriMeshDataPreprocess(IntPtr d); 1264 internal static extern void GeomTriMeshDataPreprocess(IntPtr d);
1264 1265
1265 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataSet"), SuppressUnmanagedCodeSecurity] 1266 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataSet"), SuppressUnmanagedCodeSecurity]
1266 public static extern void GeomTriMeshDataSet(IntPtr d, int data_id, IntPtr in_data); 1267 internal static extern void GeomTriMeshDataSet(IntPtr d, int data_id, IntPtr in_data);
1267 1268
1268 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataUpdate"), SuppressUnmanagedCodeSecurity] 1269 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataUpdate"), SuppressUnmanagedCodeSecurity]
1269 public static extern void GeomTriMeshDataUpdate(IntPtr d); 1270 internal static extern void GeomTriMeshDataUpdate(IntPtr d);
1270 1271
1271 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshEnableTC"), SuppressUnmanagedCodeSecurity] 1272 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshEnableTC"), SuppressUnmanagedCodeSecurity]
1272 public static extern void GeomTriMeshEnableTC(IntPtr g, int geomClass, bool enable); 1273 internal static extern void GeomTriMeshEnableTC(IntPtr g, int geomClass, bool enable);
1273 1274
1274 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetArrayCallback"), SuppressUnmanagedCodeSecurity] 1275 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetArrayCallback"), SuppressUnmanagedCodeSecurity]
1275 public static extern TriArrayCallback GeomTriMeshGetArrayCallback(IntPtr g); 1276 internal static extern TriArrayCallback GeomTriMeshGetArrayCallback(IntPtr g);
1276 1277
1277 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetCallback"), SuppressUnmanagedCodeSecurity] 1278 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetCallback"), SuppressUnmanagedCodeSecurity]
1278 public static extern TriCallback GeomTriMeshGetCallback(IntPtr g); 1279 internal static extern TriCallback GeomTriMeshGetCallback(IntPtr g);
1279 1280
1280 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetData"), SuppressUnmanagedCodeSecurity] 1281 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetData"), SuppressUnmanagedCodeSecurity]
1281 public static extern IntPtr GeomTriMeshGetData(IntPtr g); 1282 internal static extern IntPtr GeomTriMeshGetData(IntPtr g);
1282 1283
1283 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetLastTransform"), SuppressUnmanagedCodeSecurity] 1284 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetLastTransform"), SuppressUnmanagedCodeSecurity]
1284 public extern unsafe static Matrix4* GeomTriMeshGetLastTransformUnsafe(IntPtr geom); 1285 internal extern unsafe static Matrix4* GeomTriMeshGetLastTransformUnsafe(IntPtr geom);
1285 public static Matrix4 GeomTriMeshGetLastTransform(IntPtr geom) 1286 internal static Matrix4 GeomTriMeshGetLastTransform(IntPtr geom)
1286 { 1287 {
1287 unsafe { return *(GeomTriMeshGetLastTransformUnsafe(geom)); } 1288 unsafe { return *(GeomTriMeshGetLastTransformUnsafe(geom)); }
1288 } 1289 }
1289 1290
1290 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetPoint"), SuppressUnmanagedCodeSecurity] 1291 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetPoint"), SuppressUnmanagedCodeSecurity]
1291 public extern static void GeomTriMeshGetPoint(IntPtr g, int index, dReal u, dReal v, ref Vector3 outVec); 1292 internal extern static void GeomTriMeshGetPoint(IntPtr g, int index, dReal u, dReal v, ref Vector3 outVec);
1292 1293
1293 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetRayCallback"), SuppressUnmanagedCodeSecurity] 1294 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetRayCallback"), SuppressUnmanagedCodeSecurity]
1294 public static extern TriRayCallback GeomTriMeshGetRayCallback(IntPtr g); 1295 internal static extern TriRayCallback GeomTriMeshGetRayCallback(IntPtr g);
1295 1296
1296 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriangle"), SuppressUnmanagedCodeSecurity] 1297 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriangle"), SuppressUnmanagedCodeSecurity]
1297 public extern static void GeomTriMeshGetTriangle(IntPtr g, int index, ref Vector3 v0, ref Vector3 v1, ref Vector3 v2); 1298 internal extern static void GeomTriMeshGetTriangle(IntPtr g, int index, ref Vector3 v0, ref Vector3 v1, ref Vector3 v2);
1298 1299
1299 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriangleCount"), SuppressUnmanagedCodeSecurity] 1300 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriangleCount"), SuppressUnmanagedCodeSecurity]
1300 public extern static int GeomTriMeshGetTriangleCount(IntPtr g); 1301 internal extern static int GeomTriMeshGetTriangleCount(IntPtr g);
1301 1302
1302 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriMeshDataID"), SuppressUnmanagedCodeSecurity] 1303 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriMeshDataID"), SuppressUnmanagedCodeSecurity]
1303 public static extern IntPtr GeomTriMeshGetTriMeshDataID(IntPtr g); 1304 internal static extern IntPtr GeomTriMeshGetTriMeshDataID(IntPtr g);
1304 1305
1305 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshIsTCEnabled"), SuppressUnmanagedCodeSecurity] 1306 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshIsTCEnabled"), SuppressUnmanagedCodeSecurity]
1306 public static extern bool GeomTriMeshIsTCEnabled(IntPtr g, int geomClass); 1307 internal static extern bool GeomTriMeshIsTCEnabled(IntPtr g, int geomClass);
1307 1308
1308 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetArrayCallback"), SuppressUnmanagedCodeSecurity] 1309 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetArrayCallback"), SuppressUnmanagedCodeSecurity]
1309 public static extern void GeomTriMeshSetArrayCallback(IntPtr g, TriArrayCallback arrayCallback); 1310 internal static extern void GeomTriMeshSetArrayCallback(IntPtr g, TriArrayCallback arrayCallback);
1310 1311
1311 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetCallback"), SuppressUnmanagedCodeSecurity] 1312 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetCallback"), SuppressUnmanagedCodeSecurity]
1312 public static extern void GeomTriMeshSetCallback(IntPtr g, TriCallback callback); 1313 internal static extern void GeomTriMeshSetCallback(IntPtr g, TriCallback callback);
1313 1314
1314 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetData"), SuppressUnmanagedCodeSecurity] 1315 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetData"), SuppressUnmanagedCodeSecurity]
1315 public static extern void GeomTriMeshSetData(IntPtr g, IntPtr data); 1316 internal static extern void GeomTriMeshSetData(IntPtr g, IntPtr data);
1316 1317
1317 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetLastTransform"), SuppressUnmanagedCodeSecurity] 1318 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetLastTransform"), SuppressUnmanagedCodeSecurity]
1318 public static extern void GeomTriMeshSetLastTransform(IntPtr g, ref Matrix4 last_trans); 1319 internal static extern void GeomTriMeshSetLastTransform(IntPtr g, ref Matrix4 last_trans);
1319 1320
1320 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetLastTransform"), SuppressUnmanagedCodeSecurity] 1321 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetLastTransform"), SuppressUnmanagedCodeSecurity]
1321 public static extern void GeomTriMeshSetLastTransform(IntPtr g, ref dReal M00); 1322 internal static extern void GeomTriMeshSetLastTransform(IntPtr g, ref dReal M00);
1322 1323
1323 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetRayCallback"), SuppressUnmanagedCodeSecurity] 1324 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetRayCallback"), SuppressUnmanagedCodeSecurity]
1324 public static extern void GeomTriMeshSetRayCallback(IntPtr g, TriRayCallback callback); 1325 internal static extern void GeomTriMeshSetRayCallback(IntPtr g, TriRayCallback callback);
1325 1326
1326 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGetConfiguration"), SuppressUnmanagedCodeSecurity] 1327 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGetConfiguration"), SuppressUnmanagedCodeSecurity]
1327 public static extern IntPtr iGetConfiguration(); 1328 internal static extern IntPtr iGetConfiguration();
1328 1329
1329 public static string GetConfiguration() 1330 internal static string GetConfiguration()
1330 { 1331 {
1331 IntPtr ptr = iGetConfiguration(); 1332 IntPtr ptr = iGetConfiguration();
1332 string s = Marshal.PtrToStringAnsi(ptr); 1333 string s = Marshal.PtrToStringAnsi(ptr);
@@ -1334,691 +1335,688 @@ namespace OdeAPI
1334 } 1335 }
1335 1336
1336 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceCreate"), SuppressUnmanagedCodeSecurity] 1337 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceCreate"), SuppressUnmanagedCodeSecurity]
1337 public static extern IntPtr HashSpaceCreate(IntPtr space); 1338 internal static extern IntPtr HashSpaceCreate(IntPtr space);
1338 1339
1339 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceGetLevels"), SuppressUnmanagedCodeSecurity] 1340 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceGetLevels"), SuppressUnmanagedCodeSecurity]
1340 public static extern void HashSpaceGetLevels(IntPtr space, out int minlevel, out int maxlevel); 1341 internal static extern void HashSpaceGetLevels(IntPtr space, out int minlevel, out int maxlevel);
1341 1342
1342 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceSetLevels"), SuppressUnmanagedCodeSecurity] 1343 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceSetLevels"), SuppressUnmanagedCodeSecurity]
1343 public static extern void HashSpaceSetLevels(IntPtr space, int minlevel, int maxlevel); 1344 internal static extern void HashSpaceSetLevels(IntPtr space, int minlevel, int maxlevel);
1344 1345
1345 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInfiniteAABB"), SuppressUnmanagedCodeSecurity] 1346 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInfiniteAABB"), SuppressUnmanagedCodeSecurity]
1346 public static extern void InfiniteAABB(IntPtr geom, out AABB aabb); 1347 internal static extern void InfiniteAABB(IntPtr geom, out AABB aabb);
1347 1348
1348 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInitODE"), SuppressUnmanagedCodeSecurity] 1349 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInitODE"), SuppressUnmanagedCodeSecurity]
1349 public static extern void InitODE(); 1350 internal static extern void InitODE();
1350 1351
1351 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInitODE2"), SuppressUnmanagedCodeSecurity] 1352 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInitODE2"), SuppressUnmanagedCodeSecurity]
1352 public static extern int InitODE2(uint ODEInitFlags); 1353 internal static extern int InitODE2(uint ODEInitFlags);
1353 1354
1354 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dIsPositiveDefinite"), SuppressUnmanagedCodeSecurity] 1355 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dIsPositiveDefinite"), SuppressUnmanagedCodeSecurity]
1355 public static extern int IsPositiveDefinite(ref dReal A, int n); 1356 internal static extern int IsPositiveDefinite(ref dReal A, int n);
1356 1357
1357 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInvertPDMatrix"), SuppressUnmanagedCodeSecurity] 1358 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInvertPDMatrix"), SuppressUnmanagedCodeSecurity]
1358 public static extern int InvertPDMatrix(ref dReal A, out dReal Ainv, int n); 1359 internal static extern int InvertPDMatrix(ref dReal A, out dReal Ainv, int n);
1359 1360
1360 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddAMotorTorques"), SuppressUnmanagedCodeSecurity] 1361 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddAMotorTorques"), SuppressUnmanagedCodeSecurity]
1361 public static extern void JointAddAMotorTorques(IntPtr joint, dReal torque1, dReal torque2, dReal torque3); 1362 internal static extern void JointAddAMotorTorques(IntPtr joint, dReal torque1, dReal torque2, dReal torque3);
1362 1363
1363 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddHingeTorque"), SuppressUnmanagedCodeSecurity] 1364 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddHingeTorque"), SuppressUnmanagedCodeSecurity]
1364 public static extern void JointAddHingeTorque(IntPtr joint, dReal torque); 1365 internal static extern void JointAddHingeTorque(IntPtr joint, dReal torque);
1365 1366
1366 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddHinge2Torque"), SuppressUnmanagedCodeSecurity] 1367 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddHinge2Torque"), SuppressUnmanagedCodeSecurity]
1367 public static extern void JointAddHinge2Torques(IntPtr joint, dReal torque1, dReal torque2); 1368 internal static extern void JointAddHinge2Torques(IntPtr joint, dReal torque1, dReal torque2);
1368 1369
1369 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddPRTorque"), SuppressUnmanagedCodeSecurity] 1370 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddPRTorque"), SuppressUnmanagedCodeSecurity]
1370 public static extern void JointAddPRTorque(IntPtr joint, dReal torque); 1371 internal static extern void JointAddPRTorque(IntPtr joint, dReal torque);
1371 1372
1372 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddUniversalTorque"), SuppressUnmanagedCodeSecurity] 1373 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddUniversalTorque"), SuppressUnmanagedCodeSecurity]
1373 public static extern void JointAddUniversalTorques(IntPtr joint, dReal torque1, dReal torque2); 1374 internal static extern void JointAddUniversalTorques(IntPtr joint, dReal torque1, dReal torque2);
1374 1375
1375 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddSliderForce"), SuppressUnmanagedCodeSecurity] 1376 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddSliderForce"), SuppressUnmanagedCodeSecurity]
1376 public static extern void JointAddSliderForce(IntPtr joint, dReal force); 1377 internal static extern void JointAddSliderForce(IntPtr joint, dReal force);
1377 1378
1378 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAttach"), SuppressUnmanagedCodeSecurity] 1379 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAttach"), SuppressUnmanagedCodeSecurity]
1379 public static extern void JointAttach(IntPtr joint, IntPtr body1, IntPtr body2); 1380 internal static extern void JointAttach(IntPtr joint, IntPtr body1, IntPtr body2);
1380 1381
1381 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateAMotor"), SuppressUnmanagedCodeSecurity] 1382 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateAMotor"), SuppressUnmanagedCodeSecurity]
1382 public static extern IntPtr JointCreateAMotor(IntPtr world, IntPtr group); 1383 internal static extern IntPtr JointCreateAMotor(IntPtr world, IntPtr group);
1383 1384
1384 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateBall"), SuppressUnmanagedCodeSecurity] 1385 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateBall"), SuppressUnmanagedCodeSecurity]
1385 public static extern IntPtr JointCreateBall(IntPtr world, IntPtr group); 1386 internal static extern IntPtr JointCreateBall(IntPtr world, IntPtr group);
1386 1387
1387 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateContact"), SuppressUnmanagedCodeSecurity] 1388 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateContact"), SuppressUnmanagedCodeSecurity]
1388 public static extern IntPtr JointCreateContact(IntPtr world, IntPtr group, ref Contact contact); 1389 internal static extern IntPtr JointCreateContact(IntPtr world, IntPtr group, ref Contact contact);
1389 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateContact"), SuppressUnmanagedCodeSecurity] 1390 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateContact"), SuppressUnmanagedCodeSecurity]
1390 public static extern IntPtr JointCreateContactPtr(IntPtr world, IntPtr group, IntPtr contact); 1391 internal static extern IntPtr JointCreateContactPtr(IntPtr world, IntPtr group, IntPtr contact);
1391 1392
1392 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateFixed"), SuppressUnmanagedCodeSecurity] 1393 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateFixed"), SuppressUnmanagedCodeSecurity]
1393 public static extern IntPtr JointCreateFixed(IntPtr world, IntPtr group); 1394 internal static extern IntPtr JointCreateFixed(IntPtr world, IntPtr group);
1394 1395
1395 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateHinge"), SuppressUnmanagedCodeSecurity] 1396 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateHinge"), SuppressUnmanagedCodeSecurity]
1396 public static extern IntPtr JointCreateHinge(IntPtr world, IntPtr group); 1397 internal static extern IntPtr JointCreateHinge(IntPtr world, IntPtr group);
1397 1398
1398 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateHinge2"), SuppressUnmanagedCodeSecurity] 1399 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateHinge2"), SuppressUnmanagedCodeSecurity]
1399 public static extern IntPtr JointCreateHinge2(IntPtr world, IntPtr group); 1400 internal static extern IntPtr JointCreateHinge2(IntPtr world, IntPtr group);
1400 1401
1401 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateLMotor"), SuppressUnmanagedCodeSecurity] 1402 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateLMotor"), SuppressUnmanagedCodeSecurity]
1402 public static extern IntPtr JointCreateLMotor(IntPtr world, IntPtr group); 1403 internal static extern IntPtr JointCreateLMotor(IntPtr world, IntPtr group);
1403 1404
1404 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateNull"), SuppressUnmanagedCodeSecurity] 1405 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateNull"), SuppressUnmanagedCodeSecurity]
1405 public static extern IntPtr JointCreateNull(IntPtr world, IntPtr group); 1406 internal static extern IntPtr JointCreateNull(IntPtr world, IntPtr group);
1406 1407
1407 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreatePR"), SuppressUnmanagedCodeSecurity] 1408 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreatePR"), SuppressUnmanagedCodeSecurity]
1408 public static extern IntPtr JointCreatePR(IntPtr world, IntPtr group); 1409 internal static extern IntPtr JointCreatePR(IntPtr world, IntPtr group);
1409 1410
1410 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreatePlane2D"), SuppressUnmanagedCodeSecurity] 1411 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreatePlane2D"), SuppressUnmanagedCodeSecurity]
1411 public static extern IntPtr JointCreatePlane2D(IntPtr world, IntPtr group); 1412 internal static extern IntPtr JointCreatePlane2D(IntPtr world, IntPtr group);
1412 1413
1413 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateSlider"), SuppressUnmanagedCodeSecurity] 1414 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateSlider"), SuppressUnmanagedCodeSecurity]
1414 public static extern IntPtr JointCreateSlider(IntPtr world, IntPtr group); 1415 internal static extern IntPtr JointCreateSlider(IntPtr world, IntPtr group);
1415 1416
1416 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateUniversal"), SuppressUnmanagedCodeSecurity] 1417 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateUniversal"), SuppressUnmanagedCodeSecurity]
1417 public static extern IntPtr JointCreateUniversal(IntPtr world, IntPtr group); 1418 internal static extern IntPtr JointCreateUniversal(IntPtr world, IntPtr group);
1418 1419
1419 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointDestroy"), SuppressUnmanagedCodeSecurity] 1420 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointDestroy"), SuppressUnmanagedCodeSecurity]
1420 public static extern void JointDestroy(IntPtr j); 1421 internal static extern void JointDestroy(IntPtr j);
1421 1422
1422 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAngle"), SuppressUnmanagedCodeSecurity] 1423 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAngle"), SuppressUnmanagedCodeSecurity]
1423 public static extern dReal JointGetAMotorAngle(IntPtr j, int anum); 1424 internal static extern dReal JointGetAMotorAngle(IntPtr j, int anum);
1424 1425
1425 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAngleRate"), SuppressUnmanagedCodeSecurity] 1426 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAngleRate"), SuppressUnmanagedCodeSecurity]
1426 public static extern dReal JointGetAMotorAngleRate(IntPtr j, int anum); 1427 internal static extern dReal JointGetAMotorAngleRate(IntPtr j, int anum);
1427 1428
1428 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAxis"), SuppressUnmanagedCodeSecurity] 1429 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAxis"), SuppressUnmanagedCodeSecurity]
1429 public static extern void JointGetAMotorAxis(IntPtr j, int anum, out Vector3 result); 1430 internal static extern void JointGetAMotorAxis(IntPtr j, int anum, out Vector3 result);
1430 1431
1431 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAxisRel"), SuppressUnmanagedCodeSecurity] 1432 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAxisRel"), SuppressUnmanagedCodeSecurity]
1432 public static extern int JointGetAMotorAxisRel(IntPtr j, int anum); 1433 internal static extern int JointGetAMotorAxisRel(IntPtr j, int anum);
1433 1434
1434 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorMode"), SuppressUnmanagedCodeSecurity] 1435 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorMode"), SuppressUnmanagedCodeSecurity]
1435 public static extern int JointGetAMotorMode(IntPtr j); 1436 internal static extern int JointGetAMotorMode(IntPtr j);
1436 1437
1437 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorNumAxes"), SuppressUnmanagedCodeSecurity] 1438 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorNumAxes"), SuppressUnmanagedCodeSecurity]
1438 public static extern int JointGetAMotorNumAxes(IntPtr j); 1439 internal static extern int JointGetAMotorNumAxes(IntPtr j);
1439 1440
1440 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorParam"), SuppressUnmanagedCodeSecurity] 1441 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorParam"), SuppressUnmanagedCodeSecurity]
1441 public static extern dReal JointGetAMotorParam(IntPtr j, int parameter); 1442 internal static extern dReal JointGetAMotorParam(IntPtr j, int parameter);
1442 1443
1443 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBallAnchor"), SuppressUnmanagedCodeSecurity] 1444 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBallAnchor"), SuppressUnmanagedCodeSecurity]
1444 public static extern void JointGetBallAnchor(IntPtr j, out Vector3 result); 1445 internal static extern void JointGetBallAnchor(IntPtr j, out Vector3 result);
1445 1446
1446 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBallAnchor2"), SuppressUnmanagedCodeSecurity] 1447 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBallAnchor2"), SuppressUnmanagedCodeSecurity]
1447 public static extern void JointGetBallAnchor2(IntPtr j, out Vector3 result); 1448 internal static extern void JointGetBallAnchor2(IntPtr j, out Vector3 result);
1448 1449
1449 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBody"), SuppressUnmanagedCodeSecurity] 1450 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBody"), SuppressUnmanagedCodeSecurity]
1450 public static extern IntPtr JointGetBody(IntPtr j); 1451 internal static extern IntPtr JointGetBody(IntPtr j);
1451 1452
1452 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetData"), SuppressUnmanagedCodeSecurity] 1453 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetData"), SuppressUnmanagedCodeSecurity]
1453 public static extern IntPtr JointGetData(IntPtr j); 1454 internal static extern IntPtr JointGetData(IntPtr j);
1454 1455
1455 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetFeedback"), SuppressUnmanagedCodeSecurity] 1456 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetFeedback"), SuppressUnmanagedCodeSecurity]
1456 public extern unsafe static JointFeedback* JointGetFeedbackUnsafe(IntPtr j); 1457 internal extern unsafe static JointFeedback* JointGetFeedbackUnsafe(IntPtr j);
1457 public static JointFeedback JointGetFeedback(IntPtr j) 1458 internal static JointFeedback JointGetFeedback(IntPtr j)
1458 { 1459 {
1459 unsafe { return *(JointGetFeedbackUnsafe(j)); } 1460 unsafe { return *(JointGetFeedbackUnsafe(j)); }
1460 } 1461 }
1461 1462
1462 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAnchor"), SuppressUnmanagedCodeSecurity] 1463 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAnchor"), SuppressUnmanagedCodeSecurity]
1463 public static extern void JointGetHingeAnchor(IntPtr j, out Vector3 result); 1464 internal static extern void JointGetHingeAnchor(IntPtr j, out Vector3 result);
1464 1465
1465 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAngle"), SuppressUnmanagedCodeSecurity] 1466 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAngle"), SuppressUnmanagedCodeSecurity]
1466 public static extern dReal JointGetHingeAngle(IntPtr j); 1467 internal static extern dReal JointGetHingeAngle(IntPtr j);
1467 1468
1468 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAngleRate"), SuppressUnmanagedCodeSecurity] 1469 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAngleRate"), SuppressUnmanagedCodeSecurity]
1469 public static extern dReal JointGetHingeAngleRate(IntPtr j); 1470 internal static extern dReal JointGetHingeAngleRate(IntPtr j);
1470 1471
1471 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAxis"), SuppressUnmanagedCodeSecurity] 1472 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAxis"), SuppressUnmanagedCodeSecurity]
1472 public static extern void JointGetHingeAxis(IntPtr j, out Vector3 result); 1473 internal static extern void JointGetHingeAxis(IntPtr j, out Vector3 result);
1473 1474
1474 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeParam"), SuppressUnmanagedCodeSecurity] 1475 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeParam"), SuppressUnmanagedCodeSecurity]
1475 public static extern dReal JointGetHingeParam(IntPtr j, int parameter); 1476 internal static extern dReal JointGetHingeParam(IntPtr j, int parameter);
1476 1477
1477 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle1"), SuppressUnmanagedCodeSecurity] 1478 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle1"), SuppressUnmanagedCodeSecurity]
1478 public static extern dReal JointGetHinge2Angle1(IntPtr j); 1479 internal static extern dReal JointGetHinge2Angle1(IntPtr j);
1479 1480
1480 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle1Rate"), SuppressUnmanagedCodeSecurity] 1481 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle1Rate"), SuppressUnmanagedCodeSecurity]
1481 public static extern dReal JointGetHinge2Angle1Rate(IntPtr j); 1482 internal static extern dReal JointGetHinge2Angle1Rate(IntPtr j);
1482 1483
1483 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle2Rate"), SuppressUnmanagedCodeSecurity] 1484 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle2Rate"), SuppressUnmanagedCodeSecurity]
1484 public static extern dReal JointGetHinge2Angle2Rate(IntPtr j); 1485 internal static extern dReal JointGetHinge2Angle2Rate(IntPtr j);
1485 1486
1486 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAnchor2"), SuppressUnmanagedCodeSecurity] 1487 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAnchor2"), SuppressUnmanagedCodeSecurity]
1487 public static extern void JointGetHingeAnchor2(IntPtr j, out Vector3 result); 1488 internal static extern void JointGetHingeAnchor2(IntPtr j, out Vector3 result);
1488 1489
1489 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Anchor"), SuppressUnmanagedCodeSecurity] 1490 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Anchor"), SuppressUnmanagedCodeSecurity]
1490 public static extern void JointGetHinge2Anchor(IntPtr j, out Vector3 result); 1491 internal static extern void JointGetHinge2Anchor(IntPtr j, out Vector3 result);
1491 1492
1492 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Anchor2"), SuppressUnmanagedCodeSecurity] 1493 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Anchor2"), SuppressUnmanagedCodeSecurity]
1493 public static extern void JointGetHinge2Anchor2(IntPtr j, out Vector3 result); 1494 internal static extern void JointGetHinge2Anchor2(IntPtr j, out Vector3 result);
1494 1495
1495 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Axis1"), SuppressUnmanagedCodeSecurity] 1496 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Axis1"), SuppressUnmanagedCodeSecurity]
1496 public static extern void JointGetHinge2Axis1(IntPtr j, out Vector3 result); 1497 internal static extern void JointGetHinge2Axis1(IntPtr j, out Vector3 result);
1497 1498
1498 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Axis2"), SuppressUnmanagedCodeSecurity] 1499 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Axis2"), SuppressUnmanagedCodeSecurity]
1499 public static extern void JointGetHinge2Axis2(IntPtr j, out Vector3 result); 1500 internal static extern void JointGetHinge2Axis2(IntPtr j, out Vector3 result);
1500 1501
1501 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Param"), SuppressUnmanagedCodeSecurity] 1502 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Param"), SuppressUnmanagedCodeSecurity]
1502 public static extern dReal JointGetHinge2Param(IntPtr j, int parameter); 1503 internal static extern dReal JointGetHinge2Param(IntPtr j, int parameter);
1503 1504
1504 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorAxis"), SuppressUnmanagedCodeSecurity] 1505 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorAxis"), SuppressUnmanagedCodeSecurity]
1505 public static extern void JointGetLMotorAxis(IntPtr j, int anum, out Vector3 result); 1506 internal static extern void JointGetLMotorAxis(IntPtr j, int anum, out Vector3 result);
1506 1507
1507 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorNumAxes"), SuppressUnmanagedCodeSecurity] 1508 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorNumAxes"), SuppressUnmanagedCodeSecurity]
1508 public static extern int JointGetLMotorNumAxes(IntPtr j); 1509 internal static extern int JointGetLMotorNumAxes(IntPtr j);
1509 1510
1510 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorParam"), SuppressUnmanagedCodeSecurity] 1511 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorParam"), SuppressUnmanagedCodeSecurity]
1511 public static extern dReal JointGetLMotorParam(IntPtr j, int parameter); 1512 internal static extern dReal JointGetLMotorParam(IntPtr j, int parameter);
1512 1513
1513 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAnchor"), SuppressUnmanagedCodeSecurity] 1514 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAnchor"), SuppressUnmanagedCodeSecurity]
1514 public static extern void JointGetPRAnchor(IntPtr j, out Vector3 result); 1515 internal static extern void JointGetPRAnchor(IntPtr j, out Vector3 result);
1515 1516
1516 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAxis1"), SuppressUnmanagedCodeSecurity] 1517 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAxis1"), SuppressUnmanagedCodeSecurity]
1517 public static extern void JointGetPRAxis1(IntPtr j, out Vector3 result); 1518 internal static extern void JointGetPRAxis1(IntPtr j, out Vector3 result);
1518 1519
1519 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAxis2"), SuppressUnmanagedCodeSecurity] 1520 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAxis2"), SuppressUnmanagedCodeSecurity]
1520 public static extern void JointGetPRAxis2(IntPtr j, out Vector3 result); 1521 internal static extern void JointGetPRAxis2(IntPtr j, out Vector3 result);
1521 1522
1522 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRParam"), SuppressUnmanagedCodeSecurity] 1523 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRParam"), SuppressUnmanagedCodeSecurity]
1523 public static extern dReal JointGetPRParam(IntPtr j, int parameter); 1524 internal static extern dReal JointGetPRParam(IntPtr j, int parameter);
1524 1525
1525 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRPosition"), SuppressUnmanagedCodeSecurity] 1526 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRPosition"), SuppressUnmanagedCodeSecurity]
1526 public static extern dReal JointGetPRPosition(IntPtr j); 1527 internal static extern dReal JointGetPRPosition(IntPtr j);
1527 1528
1528 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRPositionRate"), SuppressUnmanagedCodeSecurity] 1529 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRPositionRate"), SuppressUnmanagedCodeSecurity]
1529 public static extern dReal JointGetPRPositionRate(IntPtr j); 1530 internal static extern dReal JointGetPRPositionRate(IntPtr j);
1530 1531
1531 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderAxis"), SuppressUnmanagedCodeSecurity] 1532 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderAxis"), SuppressUnmanagedCodeSecurity]
1532 public static extern void JointGetSliderAxis(IntPtr j, out Vector3 result); 1533 internal static extern void JointGetSliderAxis(IntPtr j, out Vector3 result);
1533 1534
1534 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderParam"), SuppressUnmanagedCodeSecurity] 1535 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderParam"), SuppressUnmanagedCodeSecurity]
1535 public static extern dReal JointGetSliderParam(IntPtr j, int parameter); 1536 internal static extern dReal JointGetSliderParam(IntPtr j, int parameter);
1536 1537
1537 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderPosition"), SuppressUnmanagedCodeSecurity] 1538 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderPosition"), SuppressUnmanagedCodeSecurity]
1538 public static extern dReal JointGetSliderPosition(IntPtr j); 1539 internal static extern dReal JointGetSliderPosition(IntPtr j);
1539 1540
1540 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderPositionRate"), SuppressUnmanagedCodeSecurity] 1541 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderPositionRate"), SuppressUnmanagedCodeSecurity]
1541 public static extern dReal JointGetSliderPositionRate(IntPtr j); 1542 internal static extern dReal JointGetSliderPositionRate(IntPtr j);
1542 1543
1543 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetType"), SuppressUnmanagedCodeSecurity] 1544 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetType"), SuppressUnmanagedCodeSecurity]
1544 public static extern JointType JointGetType(IntPtr j); 1545 internal static extern JointType JointGetType(IntPtr j);
1545 1546
1546 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAnchor"), SuppressUnmanagedCodeSecurity] 1547 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAnchor"), SuppressUnmanagedCodeSecurity]
1547 public static extern void JointGetUniversalAnchor(IntPtr j, out Vector3 result); 1548 internal static extern void JointGetUniversalAnchor(IntPtr j, out Vector3 result);
1548 1549
1549 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAnchor2"), SuppressUnmanagedCodeSecurity] 1550 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAnchor2"), SuppressUnmanagedCodeSecurity]
1550 public static extern void JointGetUniversalAnchor2(IntPtr j, out Vector3 result); 1551 internal static extern void JointGetUniversalAnchor2(IntPtr j, out Vector3 result);
1551 1552
1552 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle1"), SuppressUnmanagedCodeSecurity] 1553 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle1"), SuppressUnmanagedCodeSecurity]
1553 public static extern dReal JointGetUniversalAngle1(IntPtr j); 1554 internal static extern dReal JointGetUniversalAngle1(IntPtr j);
1554 1555
1555 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle1Rate"), SuppressUnmanagedCodeSecurity] 1556 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle1Rate"), SuppressUnmanagedCodeSecurity]
1556 public static extern dReal JointGetUniversalAngle1Rate(IntPtr j); 1557 internal static extern dReal JointGetUniversalAngle1Rate(IntPtr j);
1557 1558
1558 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle2"), SuppressUnmanagedCodeSecurity] 1559 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle2"), SuppressUnmanagedCodeSecurity]
1559 public static extern dReal JointGetUniversalAngle2(IntPtr j); 1560 internal static extern dReal JointGetUniversalAngle2(IntPtr j);
1560 1561
1561 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle2Rate"), SuppressUnmanagedCodeSecurity] 1562 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle2Rate"), SuppressUnmanagedCodeSecurity]
1562 public static extern dReal JointGetUniversalAngle2Rate(IntPtr j); 1563 internal static extern dReal JointGetUniversalAngle2Rate(IntPtr j);
1563 1564
1564 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngles"), SuppressUnmanagedCodeSecurity] 1565 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngles"), SuppressUnmanagedCodeSecurity]
1565 public static extern void JointGetUniversalAngles(IntPtr j, out dReal angle1, out dReal angle2); 1566 internal static extern void JointGetUniversalAngles(IntPtr j, out dReal angle1, out dReal angle2);
1566 1567
1567 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAxis1"), SuppressUnmanagedCodeSecurity] 1568 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAxis1"), SuppressUnmanagedCodeSecurity]
1568 public static extern void JointGetUniversalAxis1(IntPtr j, out Vector3 result); 1569 internal static extern void JointGetUniversalAxis1(IntPtr j, out Vector3 result);
1569 1570
1570 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAxis2"), SuppressUnmanagedCodeSecurity] 1571 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAxis2"), SuppressUnmanagedCodeSecurity]
1571 public static extern void JointGetUniversalAxis2(IntPtr j, out Vector3 result); 1572 internal static extern void JointGetUniversalAxis2(IntPtr j, out Vector3 result);
1572 1573
1573 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalParam"), SuppressUnmanagedCodeSecurity] 1574 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalParam"), SuppressUnmanagedCodeSecurity]
1574 public static extern dReal JointGetUniversalParam(IntPtr j, int parameter); 1575 internal static extern dReal JointGetUniversalParam(IntPtr j, int parameter);
1575 1576
1576 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupCreate"), SuppressUnmanagedCodeSecurity] 1577 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupCreate"), SuppressUnmanagedCodeSecurity]
1577 public static extern IntPtr JointGroupCreate(int max_size); 1578 internal static extern IntPtr JointGroupCreate(int max_size);
1578 1579
1579 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupDestroy"), SuppressUnmanagedCodeSecurity] 1580 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupDestroy"), SuppressUnmanagedCodeSecurity]
1580 public static extern void JointGroupDestroy(IntPtr group); 1581 internal static extern void JointGroupDestroy(IntPtr group);
1581 1582
1582 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupEmpty"), SuppressUnmanagedCodeSecurity] 1583 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupEmpty"), SuppressUnmanagedCodeSecurity]
1583 public static extern void JointGroupEmpty(IntPtr group); 1584 internal static extern void JointGroupEmpty(IntPtr group);
1584 1585
1585 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorAngle"), SuppressUnmanagedCodeSecurity] 1586 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorAngle"), SuppressUnmanagedCodeSecurity]
1586 public static extern void JointSetAMotorAngle(IntPtr j, int anum, dReal angle); 1587 internal static extern void JointSetAMotorAngle(IntPtr j, int anum, dReal angle);
1587 1588
1588 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorAxis"), SuppressUnmanagedCodeSecurity] 1589 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorAxis"), SuppressUnmanagedCodeSecurity]
1589 public static extern void JointSetAMotorAxis(IntPtr j, int anum, int rel, dReal x, dReal y, dReal z); 1590 internal static extern void JointSetAMotorAxis(IntPtr j, int anum, int rel, dReal x, dReal y, dReal z);
1590 1591
1591 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorMode"), SuppressUnmanagedCodeSecurity] 1592 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorMode"), SuppressUnmanagedCodeSecurity]
1592 public static extern void JointSetAMotorMode(IntPtr j, int mode); 1593 internal static extern void JointSetAMotorMode(IntPtr j, int mode);
1593 1594
1594 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorNumAxes"), SuppressUnmanagedCodeSecurity] 1595 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorNumAxes"), SuppressUnmanagedCodeSecurity]
1595 public static extern void JointSetAMotorNumAxes(IntPtr group, int num); 1596 internal static extern void JointSetAMotorNumAxes(IntPtr group, int num);
1596 1597
1597 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorParam"), SuppressUnmanagedCodeSecurity] 1598 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorParam"), SuppressUnmanagedCodeSecurity]
1598 public static extern void JointSetAMotorParam(IntPtr group, int parameter, dReal value); 1599 internal static extern void JointSetAMotorParam(IntPtr group, int parameter, dReal value);
1599 1600
1600 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetBallAnchor"), SuppressUnmanagedCodeSecurity] 1601 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetBallAnchor"), SuppressUnmanagedCodeSecurity]
1601 public static extern void JointSetBallAnchor(IntPtr j, dReal x, dReal y, dReal z); 1602 internal static extern void JointSetBallAnchor(IntPtr j, dReal x, dReal y, dReal z);
1602 1603
1603 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetBallAnchor2"), SuppressUnmanagedCodeSecurity] 1604 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetBallAnchor2"), SuppressUnmanagedCodeSecurity]
1604 public static extern void JointSetBallAnchor2(IntPtr j, dReal x, dReal y, dReal z); 1605 internal static extern void JointSetBallAnchor2(IntPtr j, dReal x, dReal y, dReal z);
1605 1606
1606 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetData"), SuppressUnmanagedCodeSecurity] 1607 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetData"), SuppressUnmanagedCodeSecurity]
1607 public static extern void JointSetData(IntPtr j, IntPtr data); 1608 internal static extern void JointSetData(IntPtr j, IntPtr data);
1608 1609
1609 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetFeedback"), SuppressUnmanagedCodeSecurity] 1610 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetFeedback"), SuppressUnmanagedCodeSecurity]
1610 public static extern void JointSetFeedback(IntPtr j, out JointFeedback feedback); 1611 internal static extern void JointSetFeedback(IntPtr j, out JointFeedback feedback);
1611 1612
1612 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetFixed"), SuppressUnmanagedCodeSecurity] 1613 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetFixed"), SuppressUnmanagedCodeSecurity]
1613 public static extern void JointSetFixed(IntPtr j); 1614 internal static extern void JointSetFixed(IntPtr j);
1614 1615
1615 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAnchor"), SuppressUnmanagedCodeSecurity] 1616 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAnchor"), SuppressUnmanagedCodeSecurity]
1616 public static extern void JointSetHingeAnchor(IntPtr j, dReal x, dReal y, dReal z); 1617 internal static extern void JointSetHingeAnchor(IntPtr j, dReal x, dReal y, dReal z);
1617 1618
1618 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAnchorDelta"), SuppressUnmanagedCodeSecurity] 1619 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAnchorDelta"), SuppressUnmanagedCodeSecurity]
1619 public static extern void JointSetHingeAnchorDelta(IntPtr j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az); 1620 internal static extern void JointSetHingeAnchorDelta(IntPtr j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
1620 1621
1621 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAxis"), SuppressUnmanagedCodeSecurity] 1622 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAxis"), SuppressUnmanagedCodeSecurity]
1622 public static extern void JointSetHingeAxis(IntPtr j, dReal x, dReal y, dReal z); 1623 internal static extern void JointSetHingeAxis(IntPtr j, dReal x, dReal y, dReal z);
1623 1624
1624 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeParam"), SuppressUnmanagedCodeSecurity] 1625 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeParam"), SuppressUnmanagedCodeSecurity]
1625 public static extern void JointSetHingeParam(IntPtr j, int parameter, dReal value); 1626 internal static extern void JointSetHingeParam(IntPtr j, int parameter, dReal value);
1626 1627
1627 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Anchor"), SuppressUnmanagedCodeSecurity] 1628 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Anchor"), SuppressUnmanagedCodeSecurity]
1628 public static extern void JointSetHinge2Anchor(IntPtr j, dReal x, dReal y, dReal z); 1629 internal static extern void JointSetHinge2Anchor(IntPtr j, dReal x, dReal y, dReal z);
1629 1630
1630 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Axis1"), SuppressUnmanagedCodeSecurity] 1631 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Axis1"), SuppressUnmanagedCodeSecurity]
1631 public static extern void JointSetHinge2Axis1(IntPtr j, dReal x, dReal y, dReal z); 1632 internal static extern void JointSetHinge2Axis1(IntPtr j, dReal x, dReal y, dReal z);
1632 1633
1633 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Axis2"), SuppressUnmanagedCodeSecurity] 1634 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Axis2"), SuppressUnmanagedCodeSecurity]
1634 public static extern void JointSetHinge2Axis2(IntPtr j, dReal x, dReal y, dReal z); 1635 internal static extern void JointSetHinge2Axis2(IntPtr j, dReal x, dReal y, dReal z);
1635 1636
1636 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Param"), SuppressUnmanagedCodeSecurity] 1637 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Param"), SuppressUnmanagedCodeSecurity]
1637 public static extern void JointSetHinge2Param(IntPtr j, int parameter, dReal value); 1638 internal static extern void JointSetHinge2Param(IntPtr j, int parameter, dReal value);
1638 1639
1639 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorAxis"), SuppressUnmanagedCodeSecurity] 1640 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorAxis"), SuppressUnmanagedCodeSecurity]
1640 public static extern void JointSetLMotorAxis(IntPtr j, int anum, int rel, dReal x, dReal y, dReal z); 1641 internal static extern void JointSetLMotorAxis(IntPtr j, int anum, int rel, dReal x, dReal y, dReal z);
1641 1642
1642 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorNumAxes"), SuppressUnmanagedCodeSecurity] 1643 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorNumAxes"), SuppressUnmanagedCodeSecurity]
1643 public static extern void JointSetLMotorNumAxes(IntPtr j, int num); 1644 internal static extern void JointSetLMotorNumAxes(IntPtr j, int num);
1644 1645
1645 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorParam"), SuppressUnmanagedCodeSecurity] 1646 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorParam"), SuppressUnmanagedCodeSecurity]
1646 public static extern void JointSetLMotorParam(IntPtr j, int parameter, dReal value); 1647 internal static extern void JointSetLMotorParam(IntPtr j, int parameter, dReal value);
1647 1648
1648 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DAngleParam"), SuppressUnmanagedCodeSecurity] 1649 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DAngleParam"), SuppressUnmanagedCodeSecurity]
1649 public static extern void JointSetPlane2DAngleParam(IntPtr j, int parameter, dReal value); 1650 internal static extern void JointSetPlane2DAngleParam(IntPtr j, int parameter, dReal value);
1650 1651
1651 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DXParam"), SuppressUnmanagedCodeSecurity] 1652 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DXParam"), SuppressUnmanagedCodeSecurity]
1652 public static extern void JointSetPlane2DXParam(IntPtr j, int parameter, dReal value); 1653 internal static extern void JointSetPlane2DXParam(IntPtr j, int parameter, dReal value);
1653 1654
1654 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DYParam"), SuppressUnmanagedCodeSecurity] 1655 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DYParam"), SuppressUnmanagedCodeSecurity]
1655 public static extern void JointSetPlane2DYParam(IntPtr j, int parameter, dReal value); 1656 internal static extern void JointSetPlane2DYParam(IntPtr j, int parameter, dReal value);
1656 1657
1657 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAnchor"), SuppressUnmanagedCodeSecurity] 1658 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAnchor"), SuppressUnmanagedCodeSecurity]
1658 public static extern void JointSetPRAnchor(IntPtr j, dReal x, dReal y, dReal z); 1659 internal static extern void JointSetPRAnchor(IntPtr j, dReal x, dReal y, dReal z);
1659 1660
1660 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAxis1"), SuppressUnmanagedCodeSecurity] 1661 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAxis1"), SuppressUnmanagedCodeSecurity]
1661 public static extern void JointSetPRAxis1(IntPtr j, dReal x, dReal y, dReal z); 1662 internal static extern void JointSetPRAxis1(IntPtr j, dReal x, dReal y, dReal z);
1662 1663
1663 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAxis2"), SuppressUnmanagedCodeSecurity] 1664 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAxis2"), SuppressUnmanagedCodeSecurity]
1664 public static extern void JointSetPRAxis2(IntPtr j, dReal x, dReal y, dReal z); 1665 internal static extern void JointSetPRAxis2(IntPtr j, dReal x, dReal y, dReal z);
1665 1666
1666 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRParam"), SuppressUnmanagedCodeSecurity] 1667 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRParam"), SuppressUnmanagedCodeSecurity]
1667 public static extern void JointSetPRParam(IntPtr j, int parameter, dReal value); 1668 internal static extern void JointSetPRParam(IntPtr j, int parameter, dReal value);
1668 1669
1669 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderAxis"), SuppressUnmanagedCodeSecurity] 1670 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderAxis"), SuppressUnmanagedCodeSecurity]
1670 public static extern void JointSetSliderAxis(IntPtr j, dReal x, dReal y, dReal z); 1671 internal static extern void JointSetSliderAxis(IntPtr j, dReal x, dReal y, dReal z);
1671 1672
1672 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderAxisDelta"), SuppressUnmanagedCodeSecurity] 1673 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderAxisDelta"), SuppressUnmanagedCodeSecurity]
1673 public static extern void JointSetSliderAxisDelta(IntPtr j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az); 1674 internal static extern void JointSetSliderAxisDelta(IntPtr j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az);
1674 1675
1675 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderParam"), SuppressUnmanagedCodeSecurity] 1676 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderParam"), SuppressUnmanagedCodeSecurity]
1676 public static extern void JointSetSliderParam(IntPtr j, int parameter, dReal value); 1677 internal static extern void JointSetSliderParam(IntPtr j, int parameter, dReal value);
1677 1678
1678 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAnchor"), SuppressUnmanagedCodeSecurity] 1679 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAnchor"), SuppressUnmanagedCodeSecurity]
1679 public static extern void JointSetUniversalAnchor(IntPtr j, dReal x, dReal y, dReal z); 1680 internal static extern void JointSetUniversalAnchor(IntPtr j, dReal x, dReal y, dReal z);
1680 1681
1681 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAxis1"), SuppressUnmanagedCodeSecurity] 1682 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAxis1"), SuppressUnmanagedCodeSecurity]
1682 public static extern void JointSetUniversalAxis1(IntPtr j, dReal x, dReal y, dReal z); 1683 internal static extern void JointSetUniversalAxis1(IntPtr j, dReal x, dReal y, dReal z);
1683 1684
1684 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAxis2"), SuppressUnmanagedCodeSecurity] 1685 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAxis2"), SuppressUnmanagedCodeSecurity]
1685 public static extern void JointSetUniversalAxis2(IntPtr j, dReal x, dReal y, dReal z); 1686 internal static extern void JointSetUniversalAxis2(IntPtr j, dReal x, dReal y, dReal z);
1686 1687
1687 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalParam"), SuppressUnmanagedCodeSecurity] 1688 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalParam"), SuppressUnmanagedCodeSecurity]
1688 public static extern void JointSetUniversalParam(IntPtr j, int parameter, dReal value); 1689 internal static extern void JointSetUniversalParam(IntPtr j, int parameter, dReal value);
1689 1690
1690 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dLDLTAddTL"), SuppressUnmanagedCodeSecurity] 1691 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dLDLTAddTL"), SuppressUnmanagedCodeSecurity]
1691 public static extern void LDLTAddTL(ref dReal L, ref dReal d, ref dReal a, int n, int nskip); 1692 internal static extern void LDLTAddTL(ref dReal L, ref dReal d, ref dReal a, int n, int nskip);
1692 1693
1693 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassAdd"), SuppressUnmanagedCodeSecurity] 1694 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassAdd"), SuppressUnmanagedCodeSecurity]
1694 public static extern void MassAdd(ref Mass a, ref Mass b); 1695 internal static extern void MassAdd(ref Mass a, ref Mass b);
1695 1696
1696 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassAdjust"), SuppressUnmanagedCodeSecurity] 1697 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassAdjust"), SuppressUnmanagedCodeSecurity]
1697 public static extern void MassAdjust(ref Mass m, dReal newmass); 1698 internal static extern void MassAdjust(ref Mass m, dReal newmass);
1698 1699
1699 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassCheck"), SuppressUnmanagedCodeSecurity] 1700 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassCheck"), SuppressUnmanagedCodeSecurity]
1700 public static extern bool MassCheck(ref Mass m); 1701 internal static extern bool MassCheck(ref Mass m);
1701 1702
1702 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassRotate"), SuppressUnmanagedCodeSecurity] 1703 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassRotate"), SuppressUnmanagedCodeSecurity]
1703 public static extern void MassRotate(ref Mass mass, ref Matrix3 R); 1704 internal static extern void MassRotate(ref Mass mass, ref Matrix3 R);
1704 1705
1705 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassRotate"), SuppressUnmanagedCodeSecurity] 1706 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassRotate"), SuppressUnmanagedCodeSecurity]
1706 public static extern void MassRotate(ref Mass mass, ref dReal M00); 1707 internal static extern void MassRotate(ref Mass mass, ref dReal M00);
1707 1708
1708 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetBox"), SuppressUnmanagedCodeSecurity] 1709 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetBox"), SuppressUnmanagedCodeSecurity]
1709 public static extern void MassSetBox(out Mass mass, dReal density, dReal lx, dReal ly, dReal lz); 1710 internal static extern void MassSetBox(out Mass mass, dReal density, dReal lx, dReal ly, dReal lz);
1710 1711
1711 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetBoxTotal"), SuppressUnmanagedCodeSecurity] 1712 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetBoxTotal"), SuppressUnmanagedCodeSecurity]
1712 public static extern void MassSetBoxTotal(out Mass mass, dReal total_mass, dReal lx, dReal ly, dReal lz); 1713 internal static extern void MassSetBoxTotal(out Mass mass, dReal total_mass, dReal lx, dReal ly, dReal lz);
1713 1714
1714 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCapsule"), SuppressUnmanagedCodeSecurity] 1715 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCapsule"), SuppressUnmanagedCodeSecurity]
1715 public static extern void MassSetCapsule(out Mass mass, dReal density, int direction, dReal radius, dReal length); 1716 internal static extern void MassSetCapsule(out Mass mass, dReal density, int direction, dReal radius, dReal length);
1716 1717
1717 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCapsuleTotal"), SuppressUnmanagedCodeSecurity] 1718 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCapsuleTotal"), SuppressUnmanagedCodeSecurity]
1718 public static extern void MassSetCapsuleTotal(out Mass mass, dReal total_mass, int direction, dReal radius, dReal length); 1719 internal static extern void MassSetCapsuleTotal(out Mass mass, dReal total_mass, int direction, dReal radius, dReal length);
1719 1720
1720 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCylinder"), SuppressUnmanagedCodeSecurity] 1721 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCylinder"), SuppressUnmanagedCodeSecurity]
1721 public static extern void MassSetCylinder(out Mass mass, dReal density, int direction, dReal radius, dReal length); 1722 internal static extern void MassSetCylinder(out Mass mass, dReal density, int direction, dReal radius, dReal length);
1722 1723
1723 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCylinderTotal"), SuppressUnmanagedCodeSecurity] 1724 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCylinderTotal"), SuppressUnmanagedCodeSecurity]
1724 public static extern void MassSetCylinderTotal(out Mass mass, dReal total_mass, int direction, dReal radius, dReal length); 1725 internal static extern void MassSetCylinderTotal(out Mass mass, dReal total_mass, int direction, dReal radius, dReal length);
1725 1726
1726 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetParameters"), SuppressUnmanagedCodeSecurity] 1727 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetParameters"), SuppressUnmanagedCodeSecurity]
1727 public static extern void MassSetParameters(out Mass mass, dReal themass, 1728 internal static extern void MassSetParameters(out Mass mass, dReal themass,
1728 dReal cgx, dReal cgy, dReal cgz, 1729 dReal cgx, dReal cgy, dReal cgz,
1729 dReal i11, dReal i22, dReal i33, 1730 dReal i11, dReal i22, dReal i33,
1730 dReal i12, dReal i13, dReal i23); 1731 dReal i12, dReal i13, dReal i23);
1731 1732
1732 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetSphere"), SuppressUnmanagedCodeSecurity] 1733 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetSphere"), SuppressUnmanagedCodeSecurity]
1733 public static extern void MassSetSphere(out Mass mass, dReal density, dReal radius); 1734 internal static extern void MassSetSphere(out Mass mass, dReal density, dReal radius);
1734 1735
1735 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetSphereTotal"), SuppressUnmanagedCodeSecurity] 1736 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetSphereTotal"), SuppressUnmanagedCodeSecurity]
1736 public static extern void dMassSetSphereTotal(out Mass mass, dReal total_mass, dReal radius); 1737 internal static extern void dMassSetSphereTotal(out Mass mass, dReal total_mass, dReal radius);
1737 1738
1738 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetTrimesh"), SuppressUnmanagedCodeSecurity] 1739 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetTrimesh"), SuppressUnmanagedCodeSecurity]
1739 public static extern void MassSetTrimesh(out Mass mass, dReal density, IntPtr g); 1740 internal static extern void MassSetTrimesh(out Mass mass, dReal density, IntPtr g);
1740 1741
1741 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetZero"), SuppressUnmanagedCodeSecurity] 1742 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetZero"), SuppressUnmanagedCodeSecurity]
1742 public static extern void MassSetZero(out Mass mass); 1743 internal static extern void MassSetZero(out Mass mass);
1743 1744
1744 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassTranslate"), SuppressUnmanagedCodeSecurity] 1745 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassTranslate"), SuppressUnmanagedCodeSecurity]
1745 public static extern void MassTranslate(ref Mass mass, dReal x, dReal y, dReal z); 1746 internal static extern void MassTranslate(ref Mass mass, dReal x, dReal y, dReal z);
1746 1747
1747 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply0"), SuppressUnmanagedCodeSecurity] 1748 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply0"), SuppressUnmanagedCodeSecurity]
1748 public static extern void Multiply0(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); 1749 internal static extern void Multiply0(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r);
1749 1750
1750 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply0"), SuppressUnmanagedCodeSecurity] 1751 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply0"), SuppressUnmanagedCodeSecurity]
1751 private static extern void MultiplyiM3V3(out Vector3 vout, ref Matrix3 matrix, ref Vector3 vect,int p, int q, int r); 1752 private static extern void MultiplyiM3V3(out Vector3 vout, ref Matrix3 matrix, ref Vector3 vect,int p, int q, int r);
1752 public static void MultiplyM3V3(out Vector3 outvector, ref Matrix3 matrix, ref Vector3 invector) 1753 internal static void MultiplyM3V3(out Vector3 outvector, ref Matrix3 matrix, ref Vector3 invector)
1753 { 1754 {
1754 MultiplyiM3V3(out outvector, ref matrix, ref invector, 3, 3, 1); 1755 MultiplyiM3V3(out outvector, ref matrix, ref invector, 3, 3, 1);
1755 } 1756 }
1756 1757
1757 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply1"), SuppressUnmanagedCodeSecurity] 1758 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply1"), SuppressUnmanagedCodeSecurity]
1758 public static extern void Multiply1(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); 1759 internal static extern void Multiply1(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r);
1759 1760
1760 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply2"), SuppressUnmanagedCodeSecurity] 1761 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply2"), SuppressUnmanagedCodeSecurity]
1761 public static extern void Multiply2(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); 1762 internal static extern void Multiply2(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r);
1762 1763
1763 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQFromAxisAndAngle"), SuppressUnmanagedCodeSecurity] 1764 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQFromAxisAndAngle"), SuppressUnmanagedCodeSecurity]
1764 public static extern void QFromAxisAndAngle(out Quaternion q, dReal ax, dReal ay, dReal az, dReal angle); 1765 internal static extern void QFromAxisAndAngle(out Quaternion q, dReal ax, dReal ay, dReal az, dReal angle);
1765 1766
1766 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQfromR"), SuppressUnmanagedCodeSecurity] 1767 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQfromR"), SuppressUnmanagedCodeSecurity]
1767 public static extern void QfromR(out Quaternion q, ref Matrix3 R); 1768 internal static extern void QfromR(out Quaternion q, ref Matrix3 R);
1768 1769
1769 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply0"), SuppressUnmanagedCodeSecurity] 1770 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply0"), SuppressUnmanagedCodeSecurity]
1770 public static extern void QMultiply0(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); 1771 internal static extern void QMultiply0(out Quaternion qa, ref Quaternion qb, ref Quaternion qc);
1771 1772
1772 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply1"), SuppressUnmanagedCodeSecurity] 1773 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply1"), SuppressUnmanagedCodeSecurity]
1773 public static extern void QMultiply1(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); 1774 internal static extern void QMultiply1(out Quaternion qa, ref Quaternion qb, ref Quaternion qc);
1774 1775
1775 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply2"), SuppressUnmanagedCodeSecurity] 1776 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply2"), SuppressUnmanagedCodeSecurity]
1776 public static extern void QMultiply2(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); 1777 internal static extern void QMultiply2(out Quaternion qa, ref Quaternion qb, ref Quaternion qc);
1777 1778
1778 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply3"), SuppressUnmanagedCodeSecurity] 1779 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply3"), SuppressUnmanagedCodeSecurity]
1779 public static extern void QMultiply3(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); 1780 internal static extern void QMultiply3(out Quaternion qa, ref Quaternion qb, ref Quaternion qc);
1780 1781
1781 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQSetIdentity"), SuppressUnmanagedCodeSecurity] 1782 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQSetIdentity"), SuppressUnmanagedCodeSecurity]
1782 public static extern void QSetIdentity(out Quaternion q); 1783 internal static extern void QSetIdentity(out Quaternion q);
1783 1784
1784 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQuadTreeSpaceCreate"), SuppressUnmanagedCodeSecurity] 1785 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQuadTreeSpaceCreate"), SuppressUnmanagedCodeSecurity]
1785 public static extern IntPtr QuadTreeSpaceCreate(IntPtr space, ref Vector3 center, ref Vector3 extents, int depth); 1786 internal static extern IntPtr QuadTreeSpaceCreate(IntPtr space, ref Vector3 center, ref Vector3 extents, int depth);
1786 1787
1787 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQuadTreeSpaceCreate"), SuppressUnmanagedCodeSecurity] 1788 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQuadTreeSpaceCreate"), SuppressUnmanagedCodeSecurity]
1788 public static extern IntPtr QuadTreeSpaceCreate(IntPtr space, ref dReal centerX, ref dReal extentsX, int depth); 1789 internal static extern IntPtr QuadTreeSpaceCreate(IntPtr space, ref dReal centerX, ref dReal extentsX, int depth);
1789 1790
1790 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRandReal"), SuppressUnmanagedCodeSecurity] 1791 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRandReal"), SuppressUnmanagedCodeSecurity]
1791 public static extern dReal RandReal(); 1792 internal static extern dReal RandReal();
1792 1793
1793 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFrom2Axes"), SuppressUnmanagedCodeSecurity] 1794 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFrom2Axes"), SuppressUnmanagedCodeSecurity]
1794 public static extern void RFrom2Axes(out Matrix3 R, dReal ax, dReal ay, dReal az, dReal bx, dReal by, dReal bz); 1795 internal static extern void RFrom2Axes(out Matrix3 R, dReal ax, dReal ay, dReal az, dReal bx, dReal by, dReal bz);
1795 1796
1796 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromAxisAndAngle"), SuppressUnmanagedCodeSecurity] 1797 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromAxisAndAngle"), SuppressUnmanagedCodeSecurity]
1797 public static extern void RFromAxisAndAngle(out Matrix3 R, dReal x, dReal y, dReal z, dReal angle); 1798 internal static extern void RFromAxisAndAngle(out Matrix3 R, dReal x, dReal y, dReal z, dReal angle);
1798 1799
1799 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromEulerAngles"), SuppressUnmanagedCodeSecurity] 1800 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromEulerAngles"), SuppressUnmanagedCodeSecurity]
1800 public static extern void RFromEulerAngles(out Matrix3 R, dReal phi, dReal theta, dReal psi); 1801 internal static extern void RFromEulerAngles(out Matrix3 R, dReal phi, dReal theta, dReal psi);
1801 1802
1802 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRfromQ"), SuppressUnmanagedCodeSecurity] 1803 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRfromQ"), SuppressUnmanagedCodeSecurity]
1803 public static extern void RfromQ(out Matrix3 R, ref Quaternion q); 1804 internal static extern void RfromQ(out Matrix3 R, ref Quaternion q);
1804 1805
1805 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromZAxis"), SuppressUnmanagedCodeSecurity] 1806 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromZAxis"), SuppressUnmanagedCodeSecurity]
1806 public static extern void RFromZAxis(out Matrix3 R, dReal ax, dReal ay, dReal az); 1807 internal static extern void RFromZAxis(out Matrix3 R, dReal ax, dReal ay, dReal az);
1807 1808
1808 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRSetIdentity"), SuppressUnmanagedCodeSecurity] 1809 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRSetIdentity"), SuppressUnmanagedCodeSecurity]
1809 public static extern void RSetIdentity(out Matrix3 R); 1810 internal static extern void RSetIdentity(out Matrix3 R);
1810 1811
1811 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSetValue"), SuppressUnmanagedCodeSecurity] 1812 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSetValue"), SuppressUnmanagedCodeSecurity]
1812 public static extern void SetValue(out dReal a, int n); 1813 internal static extern void SetValue(out dReal a, int n);
1813 1814
1814 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSetZero"), SuppressUnmanagedCodeSecurity] 1815 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSetZero"), SuppressUnmanagedCodeSecurity]
1815 public static extern void SetZero(out dReal a, int n); 1816 internal static extern void SetZero(out dReal a, int n);
1816 1817
1817 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSimpleSpaceCreate"), SuppressUnmanagedCodeSecurity] 1818 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSimpleSpaceCreate"), SuppressUnmanagedCodeSecurity]
1818 public static extern IntPtr SimpleSpaceCreate(IntPtr space); 1819 internal static extern IntPtr SimpleSpaceCreate(IntPtr space);
1819 1820
1820 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveCholesky"), SuppressUnmanagedCodeSecurity] 1821 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveCholesky"), SuppressUnmanagedCodeSecurity]
1821 public static extern void SolveCholesky(ref dReal L, out dReal b, int n); 1822 internal static extern void SolveCholesky(ref dReal L, out dReal b, int n);
1822 1823
1823 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveL1"), SuppressUnmanagedCodeSecurity] 1824 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveL1"), SuppressUnmanagedCodeSecurity]
1824 public static extern void SolveL1(ref dReal L, out dReal b, int n, int nskip); 1825 internal static extern void SolveL1(ref dReal L, out dReal b, int n, int nskip);
1825 1826
1826 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveL1T"), SuppressUnmanagedCodeSecurity] 1827 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveL1T"), SuppressUnmanagedCodeSecurity]
1827 public static extern void SolveL1T(ref dReal L, out dReal b, int n, int nskip); 1828 internal static extern void SolveL1T(ref dReal L, out dReal b, int n, int nskip);
1828 1829
1829 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveLDLT"), SuppressUnmanagedCodeSecurity] 1830 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveLDLT"), SuppressUnmanagedCodeSecurity]
1830 public static extern void SolveLDLT(ref dReal L, ref dReal d, out dReal b, int n, int nskip); 1831 internal static extern void SolveLDLT(ref dReal L, ref dReal d, out dReal b, int n, int nskip);
1831 1832
1832 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceAdd"), SuppressUnmanagedCodeSecurity] 1833 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceAdd"), SuppressUnmanagedCodeSecurity]
1833 public static extern void SpaceAdd(IntPtr space, IntPtr geom); 1834 internal static extern void SpaceAdd(IntPtr space, IntPtr geom);
1834 1835
1835 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceLockQuery"), SuppressUnmanagedCodeSecurity] 1836 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceLockQuery"), SuppressUnmanagedCodeSecurity]
1836 public static extern bool SpaceLockQuery(IntPtr space); 1837 internal static extern bool SpaceLockQuery(IntPtr space);
1837 1838
1838 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceClean"), SuppressUnmanagedCodeSecurity] 1839 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceClean"), SuppressUnmanagedCodeSecurity]
1839 public static extern void SpaceClean(IntPtr space); 1840 internal static extern void SpaceClean(IntPtr space);
1840 1841
1841 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceCollide"), SuppressUnmanagedCodeSecurity] 1842 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceCollide"), SuppressUnmanagedCodeSecurity]
1842 public static extern void SpaceCollide(IntPtr space, IntPtr data, NearCallback callback); 1843 internal static extern void SpaceCollide(IntPtr space, IntPtr data, NearCallback callback);
1843 1844
1844 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceCollide2"), SuppressUnmanagedCodeSecurity] 1845 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceCollide2"), SuppressUnmanagedCodeSecurity]
1845 public static extern void SpaceCollide2(IntPtr space1, IntPtr space2, IntPtr data, NearCallback callback); 1846 internal static extern void SpaceCollide2(IntPtr space1, IntPtr space2, IntPtr data, NearCallback callback);
1846 1847
1847 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceDestroy"), SuppressUnmanagedCodeSecurity] 1848 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceDestroy"), SuppressUnmanagedCodeSecurity]
1848 public static extern void SpaceDestroy(IntPtr space); 1849 internal static extern void SpaceDestroy(IntPtr space);
1849 1850
1850 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetCleanup"), SuppressUnmanagedCodeSecurity] 1851 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetCleanup"), SuppressUnmanagedCodeSecurity]
1851 public static extern bool SpaceGetCleanup(IntPtr space); 1852 internal static extern bool SpaceGetCleanup(IntPtr space);
1852 1853
1853 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetNumGeoms"), SuppressUnmanagedCodeSecurity] 1854 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetNumGeoms"), SuppressUnmanagedCodeSecurity]
1854 public static extern int SpaceGetNumGeoms(IntPtr space); 1855 internal static extern int SpaceGetNumGeoms(IntPtr space);
1855 1856
1856 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetGeom"), SuppressUnmanagedCodeSecurity] 1857 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetGeom"), SuppressUnmanagedCodeSecurity]
1857 public static extern IntPtr SpaceGetGeom(IntPtr space, int i); 1858 internal static extern IntPtr SpaceGetGeom(IntPtr space, int i);
1858 1859
1859 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetSublevel"), SuppressUnmanagedCodeSecurity] 1860 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetSublevel"), SuppressUnmanagedCodeSecurity]
1860 public static extern int SpaceGetSublevel(IntPtr space); 1861 internal static extern int SpaceGetSublevel(IntPtr space);
1861 1862
1862 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceQuery"), SuppressUnmanagedCodeSecurity] 1863 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceQuery"), SuppressUnmanagedCodeSecurity]
1863 public static extern bool SpaceQuery(IntPtr space, IntPtr geom); 1864 internal static extern bool SpaceQuery(IntPtr space, IntPtr geom);
1864 1865
1865 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceRemove"), SuppressUnmanagedCodeSecurity] 1866 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceRemove"), SuppressUnmanagedCodeSecurity]
1866 public static extern void SpaceRemove(IntPtr space, IntPtr geom); 1867 internal static extern void SpaceRemove(IntPtr space, IntPtr geom);
1867 1868
1868 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceSetCleanup"), SuppressUnmanagedCodeSecurity] 1869 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceSetCleanup"), SuppressUnmanagedCodeSecurity]
1869 public static extern void SpaceSetCleanup(IntPtr space, bool mode); 1870 internal static extern void SpaceSetCleanup(IntPtr space, bool mode);
1870 1871
1871 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceSetSublevel"), SuppressUnmanagedCodeSecurity] 1872 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceSetSublevel"), SuppressUnmanagedCodeSecurity]
1872 public static extern void SpaceSetSublevel(IntPtr space, int sublevel); 1873 internal static extern void SpaceSetSublevel(IntPtr space, int sublevel);
1873 1874
1874 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSweepAndPruneSpaceCreate"), SuppressUnmanagedCodeSecurity] 1875 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSweepAndPruneSpaceCreate"), SuppressUnmanagedCodeSecurity]
1875 public static extern IntPtr SweepAndPruneSpaceCreate(IntPtr space, int AxisOrder); 1876 internal static extern IntPtr SweepAndPruneSpaceCreate(IntPtr space, int AxisOrder);
1876 1877
1877 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dVectorScale"), SuppressUnmanagedCodeSecurity] 1878 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dVectorScale"), SuppressUnmanagedCodeSecurity]
1878 public static extern void VectorScale(out dReal a, ref dReal d, int n); 1879 internal static extern void VectorScale(out dReal a, ref dReal d, int n);
1879 1880
1880 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldCreate"), SuppressUnmanagedCodeSecurity] 1881 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldCreate"), SuppressUnmanagedCodeSecurity]
1881 public static extern IntPtr WorldCreate(); 1882 internal static extern IntPtr WorldCreate();
1882 1883
1883 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldDestroy"), SuppressUnmanagedCodeSecurity] 1884 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldDestroy"), SuppressUnmanagedCodeSecurity]
1884 public static extern void WorldDestroy(IntPtr world); 1885 internal static extern void WorldDestroy(IntPtr world);
1885 1886
1886 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableAverageSamplesCount"), SuppressUnmanagedCodeSecurity] 1887 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableAverageSamplesCount"), SuppressUnmanagedCodeSecurity]
1887 public static extern int WorldGetAutoDisableAverageSamplesCount(IntPtr world); 1888 internal static extern int WorldGetAutoDisableAverageSamplesCount(IntPtr world);
1888 1889
1889 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] 1890 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity]
1890 public static extern dReal WorldGetAutoDisableAngularThreshold(IntPtr world); 1891 internal static extern dReal WorldGetAutoDisableAngularThreshold(IntPtr world);
1891 1892
1892 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] 1893 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableFlag"), SuppressUnmanagedCodeSecurity]
1893 public static extern bool WorldGetAutoDisableFlag(IntPtr world); 1894 internal static extern bool WorldGetAutoDisableFlag(IntPtr world);
1894 1895
1895 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] 1896 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity]
1896 public static extern dReal WorldGetAutoDisableLinearThreshold(IntPtr world); 1897 internal static extern dReal WorldGetAutoDisableLinearThreshold(IntPtr world);
1897 1898
1898 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] 1899 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableSteps"), SuppressUnmanagedCodeSecurity]
1899 public static extern int WorldGetAutoDisableSteps(IntPtr world); 1900 internal static extern int WorldGetAutoDisableSteps(IntPtr world);
1900 1901
1901 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableTime"), SuppressUnmanagedCodeSecurity] 1902 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableTime"), SuppressUnmanagedCodeSecurity]
1902 public static extern dReal WorldGetAutoDisableTime(IntPtr world); 1903 internal static extern dReal WorldGetAutoDisableTime(IntPtr world);
1903 1904
1904 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoEnableDepthSF1"), SuppressUnmanagedCodeSecurity] 1905 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoEnableDepthSF1"), SuppressUnmanagedCodeSecurity]
1905 public static extern int WorldGetAutoEnableDepthSF1(IntPtr world); 1906 internal static extern int WorldGetAutoEnableDepthSF1(IntPtr world);
1906 1907
1907 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetCFM"), SuppressUnmanagedCodeSecurity] 1908 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetCFM"), SuppressUnmanagedCodeSecurity]
1908 public static extern dReal WorldGetCFM(IntPtr world); 1909 internal static extern dReal WorldGetCFM(IntPtr world);
1909 1910
1910 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetERP"), SuppressUnmanagedCodeSecurity] 1911 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetERP"), SuppressUnmanagedCodeSecurity]
1911 public static extern dReal WorldGetERP(IntPtr world); 1912 internal static extern dReal WorldGetERP(IntPtr world);
1912 1913
1913 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetGravity"), SuppressUnmanagedCodeSecurity] 1914 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetGravity"), SuppressUnmanagedCodeSecurity]
1914 public static extern void WorldGetGravity(IntPtr world, out Vector3 gravity); 1915 internal static extern void WorldGetGravity(IntPtr world, out Vector3 gravity);
1915 1916
1916 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetGravity"), SuppressUnmanagedCodeSecurity] 1917 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetGravity"), SuppressUnmanagedCodeSecurity]
1917 public static extern void WorldGetGravity(IntPtr world, out dReal X); 1918 internal static extern void WorldGetGravity(IntPtr world, out dReal X);
1918 1919
1919 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetContactMaxCorrectingVel"), SuppressUnmanagedCodeSecurity] 1920 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetContactMaxCorrectingVel"), SuppressUnmanagedCodeSecurity]
1920 public static extern dReal WorldGetContactMaxCorrectingVel(IntPtr world); 1921 internal static extern dReal WorldGetContactMaxCorrectingVel(IntPtr world);
1921 1922
1922 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetContactSurfaceLayer"), SuppressUnmanagedCodeSecurity] 1923 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetContactSurfaceLayer"), SuppressUnmanagedCodeSecurity]
1923 public static extern dReal WorldGetContactSurfaceLayer(IntPtr world); 1924 internal static extern dReal WorldGetContactSurfaceLayer(IntPtr world);
1924 1925
1925 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAngularDamping"), SuppressUnmanagedCodeSecurity] 1926 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAngularDamping"), SuppressUnmanagedCodeSecurity]
1926 public static extern dReal WorldGetAngularDamping(IntPtr world); 1927 internal static extern dReal WorldGetAngularDamping(IntPtr world);
1927 1928
1928 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] 1929 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity]
1929 public static extern dReal WorldGetAngularDampingThreshold(IntPtr world); 1930 internal static extern dReal WorldGetAngularDampingThreshold(IntPtr world);
1930 1931
1931 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetLinearDamping"), SuppressUnmanagedCodeSecurity] 1932 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetLinearDamping"), SuppressUnmanagedCodeSecurity]
1932 public static extern dReal WorldGetLinearDamping(IntPtr world); 1933 internal static extern dReal WorldGetLinearDamping(IntPtr world);
1933 1934
1934 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] 1935 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity]
1935 public static extern dReal WorldGetLinearDampingThreshold(IntPtr world); 1936 internal static extern dReal WorldGetLinearDampingThreshold(IntPtr world);
1936 1937
1937 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetQuickStepNumIterations"), SuppressUnmanagedCodeSecurity] 1938 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetQuickStepNumIterations"), SuppressUnmanagedCodeSecurity]
1938 public static extern int WorldGetQuickStepNumIterations(IntPtr world); 1939 internal static extern int WorldGetQuickStepNumIterations(IntPtr world);
1939 1940
1940 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetQuickStepW"), SuppressUnmanagedCodeSecurity] 1941 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetQuickStepW"), SuppressUnmanagedCodeSecurity]
1941 public static extern dReal WorldGetQuickStepW(IntPtr world); 1942 internal static extern dReal WorldGetQuickStepW(IntPtr world);
1942 1943
1943 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetMaxAngularSpeed"), SuppressUnmanagedCodeSecurity] 1944 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetMaxAngularSpeed"), SuppressUnmanagedCodeSecurity]
1944 public static extern dReal WorldGetMaxAngularSpeed(IntPtr world); 1945 internal static extern dReal WorldGetMaxAngularSpeed(IntPtr world);
1945 1946
1946 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldImpulseToForce"), SuppressUnmanagedCodeSecurity] 1947 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldImpulseToForce"), SuppressUnmanagedCodeSecurity]
1947 public static extern void WorldImpulseToForce(IntPtr world, dReal stepsize, dReal ix, dReal iy, dReal iz, out Vector3 force); 1948 internal static extern void WorldImpulseToForce(IntPtr world, dReal stepsize, dReal ix, dReal iy, dReal iz, out Vector3 force);
1948 1949
1949 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldImpulseToForce"), SuppressUnmanagedCodeSecurity] 1950 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldImpulseToForce"), SuppressUnmanagedCodeSecurity]
1950 public static extern void WorldImpulseToForce(IntPtr world, dReal stepsize, dReal ix, dReal iy, dReal iz, out dReal forceX); 1951 internal static extern void WorldImpulseToForce(IntPtr world, dReal stepsize, dReal ix, dReal iy, dReal iz, out dReal forceX);
1951 1952
1952 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldQuickStep"), SuppressUnmanagedCodeSecurity] 1953 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldQuickStep"), SuppressUnmanagedCodeSecurity]
1953 public static extern void WorldQuickStep(IntPtr world, dReal stepsize); 1954 internal static extern void WorldQuickStep(IntPtr world, dReal stepsize);
1954 1955
1955 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAngularDamping"), SuppressUnmanagedCodeSecurity] 1956 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAngularDamping"), SuppressUnmanagedCodeSecurity]
1956 public static extern void WorldSetAngularDamping(IntPtr world, dReal scale); 1957 internal static extern void WorldSetAngularDamping(IntPtr world, dReal scale);
1957 1958
1958 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] 1959 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity]
1959 public static extern void WorldSetAngularDampingThreshold(IntPtr world, dReal threshold); 1960 internal static extern void WorldSetAngularDampingThreshold(IntPtr world, dReal threshold);
1960 1961
1961 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] 1962 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity]
1962 public static extern void WorldSetAutoDisableAngularThreshold(IntPtr world, dReal angular_threshold); 1963 internal static extern void WorldSetAutoDisableAngularThreshold(IntPtr world, dReal angular_threshold);
1963 1964
1964 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableAverageSamplesCount"), SuppressUnmanagedCodeSecurity] 1965 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableAverageSamplesCount"), SuppressUnmanagedCodeSecurity]
1965 public static extern void WorldSetAutoDisableAverageSamplesCount(IntPtr world, int average_samples_count); 1966 internal static extern void WorldSetAutoDisableAverageSamplesCount(IntPtr world, int average_samples_count);
1966 1967
1967 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] 1968 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableFlag"), SuppressUnmanagedCodeSecurity]
1968 public static extern void WorldSetAutoDisableFlag(IntPtr world, bool do_auto_disable); 1969 internal static extern void WorldSetAutoDisableFlag(IntPtr world, bool do_auto_disable);
1969 1970
1970 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] 1971 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity]
1971 public static extern void WorldSetAutoDisableLinearThreshold(IntPtr world, dReal linear_threshold); 1972 internal static extern void WorldSetAutoDisableLinearThreshold(IntPtr world, dReal linear_threshold);
1972 1973
1973 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] 1974 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableSteps"), SuppressUnmanagedCodeSecurity]
1974 public static extern void WorldSetAutoDisableSteps(IntPtr world, int steps); 1975 internal static extern void WorldSetAutoDisableSteps(IntPtr world, int steps);
1975 1976
1976 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableTime"), SuppressUnmanagedCodeSecurity] 1977 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableTime"), SuppressUnmanagedCodeSecurity]
1977 public static extern void WorldSetAutoDisableTime(IntPtr world, dReal time); 1978 internal static extern void WorldSetAutoDisableTime(IntPtr world, dReal time);
1978 1979
1979 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoEnableDepthSF1"), SuppressUnmanagedCodeSecurity] 1980 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoEnableDepthSF1"), SuppressUnmanagedCodeSecurity]
1980 public static extern void WorldSetAutoEnableDepthSF1(IntPtr world, int autoEnableDepth); 1981 internal static extern void WorldSetAutoEnableDepthSF1(IntPtr world, int autoEnableDepth);
1981 1982
1982 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetCFM"), SuppressUnmanagedCodeSecurity] 1983 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetCFM"), SuppressUnmanagedCodeSecurity]
1983 public static extern void WorldSetCFM(IntPtr world, dReal cfm); 1984 internal static extern void WorldSetCFM(IntPtr world, dReal cfm);
1984 1985
1985 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetContactMaxCorrectingVel"), SuppressUnmanagedCodeSecurity] 1986 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetContactMaxCorrectingVel"), SuppressUnmanagedCodeSecurity]
1986 public static extern void WorldSetContactMaxCorrectingVel(IntPtr world, dReal vel); 1987 internal static extern void WorldSetContactMaxCorrectingVel(IntPtr world, dReal vel);
1987 1988
1988 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetContactSurfaceLayer"), SuppressUnmanagedCodeSecurity] 1989 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetContactSurfaceLayer"), SuppressUnmanagedCodeSecurity]
1989 public static extern void WorldSetContactSurfaceLayer(IntPtr world, dReal depth); 1990 internal static extern void WorldSetContactSurfaceLayer(IntPtr world, dReal depth);
1990 1991
1991 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetDamping"), SuppressUnmanagedCodeSecurity] 1992 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetDamping"), SuppressUnmanagedCodeSecurity]
1992 public static extern void WorldSetDamping(IntPtr world, dReal linear_scale, dReal angular_scale); 1993 internal static extern void WorldSetDamping(IntPtr world, dReal linear_scale, dReal angular_scale);
1993 1994
1994 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetERP"), SuppressUnmanagedCodeSecurity] 1995 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetERP"), SuppressUnmanagedCodeSecurity]
1995 public static extern void WorldSetERP(IntPtr world, dReal erp); 1996 internal static extern void WorldSetERP(IntPtr world, dReal erp);
1996 1997
1997 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetGravity"), SuppressUnmanagedCodeSecurity] 1998 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetGravity"), SuppressUnmanagedCodeSecurity]
1998 public static extern void WorldSetGravity(IntPtr world, dReal x, dReal y, dReal z); 1999 internal static extern void WorldSetGravity(IntPtr world, dReal x, dReal y, dReal z);
1999 2000
2000 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetLinearDamping"), SuppressUnmanagedCodeSecurity] 2001 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetLinearDamping"), SuppressUnmanagedCodeSecurity]
2001 public static extern void WorldSetLinearDamping(IntPtr world, dReal scale); 2002 internal static extern void WorldSetLinearDamping(IntPtr world, dReal scale);
2002 2003
2003 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] 2004 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity]
2004 public static extern void WorldSetLinearDampingThreshold(IntPtr world, dReal threshold); 2005 internal static extern void WorldSetLinearDampingThreshold(IntPtr world, dReal threshold);
2005 2006
2006 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetQuickStepNumIterations"), SuppressUnmanagedCodeSecurity] 2007 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetQuickStepNumIterations"), SuppressUnmanagedCodeSecurity]
2007 public static extern void WorldSetQuickStepNumIterations(IntPtr world, int num); 2008 internal static extern void WorldSetQuickStepNumIterations(IntPtr world, int num);
2008 2009
2009 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetQuickStepW"), SuppressUnmanagedCodeSecurity] 2010 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetQuickStepW"), SuppressUnmanagedCodeSecurity]
2010 public static extern void WorldSetQuickStepW(IntPtr world, dReal over_relaxation); 2011 internal static extern void WorldSetQuickStepW(IntPtr world, dReal over_relaxation);
2011 2012
2012 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetMaxAngularSpeed"), SuppressUnmanagedCodeSecurity] 2013 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetMaxAngularSpeed"), SuppressUnmanagedCodeSecurity]
2013 public static extern void WorldSetMaxAngularSpeed(IntPtr world, dReal max_speed); 2014 internal static extern void WorldSetMaxAngularSpeed(IntPtr world, dReal max_speed);
2014 2015
2015 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldStep"), SuppressUnmanagedCodeSecurity] 2016 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldStep"), SuppressUnmanagedCodeSecurity]
2016 public static extern void WorldStep(IntPtr world, dReal stepsize); 2017 internal static extern void WorldStep(IntPtr world, dReal stepsize);
2017 2018
2018 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldStepFast1"), SuppressUnmanagedCodeSecurity] 2019 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldStepFast1"), SuppressUnmanagedCodeSecurity]
2019 public static extern void WorldStepFast1(IntPtr world, dReal stepsize, int maxiterations); 2020 internal static extern void WorldStepFast1(IntPtr world, dReal stepsize, int maxiterations);
2020
2021 [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldExportDIF"), SuppressUnmanagedCodeSecurity]
2022 public static extern void WorldExportDIF(IntPtr world, string filename, bool append, string prefix);
2023 } 2021 }
2024} 2022}
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
index 0e46471..60cc549 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
@@ -32,7 +32,6 @@ using System;
32using System.Collections.Generic; 32using System.Collections.Generic;
33using System.Reflection; 33using System.Reflection;
34using OpenMetaverse; 34using OpenMetaverse;
35using OdeAPI;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.PhysicsModules.SharedBase; 36using OpenSim.Region.PhysicsModules.SharedBase;
38using log4net; 37using log4net;
@@ -43,7 +42,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
43 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. 42 /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves.
44 /// </summary> 43 /// </summary>
45 44
46 public enum dParam : int 45 public enum dParam:int
47 { 46 {
48 LowStop = 0, 47 LowStop = 0,
49 HiStop = 1, 48 HiStop = 1,
@@ -68,7 +67,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
68 StopCFM3 = 8 + 512 67 StopCFM3 = 8 + 512
69 } 68 }
70 69
71 public class OdeCharacter : PhysicsActor 70 public class OdeCharacter:PhysicsActor
72 { 71 {
73 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 72 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
74 73
@@ -122,7 +121,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
122 121
123 private bool m_freemove = false; 122 private bool m_freemove = false;
124 123
125// private string m_name = String.Empty; 124 // private string m_name = String.Empty;
126 // other filter control 125 // other filter control
127 int m_colliderfilter = 0; 126 int m_colliderfilter = 0;
128 int m_colliderGroundfilter = 0; 127 int m_colliderGroundfilter = 0;
@@ -144,7 +143,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
144 143
145 public IntPtr Amotor = IntPtr.Zero; 144 public IntPtr Amotor = IntPtr.Zero;
146 145
147 public d.Mass ShellMass; 146 internal SafeNativeMethods.Mass ShellMass;
148 147
149 public int m_eventsubscription = 0; 148 public int m_eventsubscription = 0;
150 private int m_cureventsubscription = 0; 149 private int m_cureventsubscription = 0;
@@ -165,7 +164,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
165 private float m_targetHoverHeight; 164 private float m_targetHoverHeight;
166 165
167 166
168 public OdeCharacter(uint localID, String avName, ODEScene parent_scene, Vector3 pos, Vector3 pSize, float pfeetOffset, float density, float walk_divisor, float rundivisor) 167 public OdeCharacter(uint localID,String avName,ODEScene parent_scene,Vector3 pos,Vector3 pSize,float pfeetOffset,float density,float walk_divisor,float rundivisor)
169 { 168 {
170 m_uuid = UUID.Random(); 169 m_uuid = UUID.Random();
171 m_localID = localID; 170 m_localID = localID;
@@ -174,21 +173,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde
174 timeStep = parent_scene.ODE_STEPSIZE; 173 timeStep = parent_scene.ODE_STEPSIZE;
175 invtimeStep = 1 / timeStep; 174 invtimeStep = 1 / timeStep;
176 175
177 if (pos.IsFinite()) 176 if(pos.IsFinite())
178 { 177 {
179 if (pos.Z > 99999f) 178 if(pos.Z > 99999f)
180 { 179 {
181 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; 180 pos.Z = parent_scene.GetTerrainHeightAtXY(127,127) + 5;
182 } 181 }
183 if (pos.Z < -100f) // shouldn't this be 0 ? 182 if(pos.Z < -100f) // shouldn't this be 0 ?
184 { 183 {
185 pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; 184 pos.Z = parent_scene.GetTerrainHeightAtXY(127,127) + 5;
186 } 185 }
187 _position = pos; 186 _position = pos;
188 } 187 }
189 else 188 else
190 { 189 {
191 _position = new Vector3(((float)m_parent_scene.WorldExtents.X * 0.5f), ((float)m_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f); 190 _position = new Vector3(((float)m_parent_scene.WorldExtents.X * 0.5f),((float)m_parent_scene.WorldExtents.Y * 0.5f),parent_scene.GetTerrainHeightAtXY(128f,128f) + 10f);
192 m_log.Warn("[PHYSICS]: Got NaN Position on Character Create"); 191 m_log.Warn("[PHYSICS]: Got NaN Position on Character Create");
193 } 192 }
194 193
@@ -216,7 +215,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
216 walkDivisor = walk_divisor; 215 walkDivisor = walk_divisor;
217 runDivisor = rundivisor; 216 runDivisor = rundivisor;
218 217
219 m_mass = m_density * m_size.X * m_size.Y * m_size.Z; ; // sure we have a default 218 m_mass = m_density * m_size.X * m_size.Y * m_size.Z;
219 ; // sure we have a default
220 220
221 PID_D = basePID_D * m_mass * invtimeStep; 221 PID_D = basePID_D * m_mass * invtimeStep;
222 PID_P = basePID_P * m_mass * invtimeStep; 222 PID_P = basePID_P * m_mass * invtimeStep;
@@ -225,13 +225,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
225 225
226 Name = avName; 226 Name = avName;
227 227
228 AddChange(changes.Add, null); 228 AddChange(changes.Add,null);
229 } 229 }
230 230
231 public override int PhysicsActorType 231 public override int PhysicsActorType
232 { 232 {
233 get { return (int)ActorTypes.Agent; } 233 get
234 set { return; } 234 {
235 return (int)ActorTypes.Agent;
236 }
237 set
238 {
239 return;
240 }
235 } 241 }
236 242
237 public override void getContactData(ref ContactData cdata) 243 public override void getContactData(ref ContactData cdata)
@@ -241,68 +247,116 @@ namespace OpenSim.Region.PhysicsModule.ubOde
241 cdata.softcolide = false; 247 cdata.softcolide = false;
242 } 248 }
243 249
244 public override bool Building { get; set; } 250 public override bool Building
251 {
252 get; set;
253 }
245 254
246 /// <summary> 255 /// <summary>
247 /// If this is set, the avatar will move faster 256 /// If this is set, the avatar will move faster
248 /// </summary> 257 /// </summary>
249 public override bool SetAlwaysRun 258 public override bool SetAlwaysRun
250 { 259 {
251 get { return m_alwaysRun; } 260 get
252 set { m_alwaysRun = value; } 261 {
262 return m_alwaysRun;
263 }
264 set
265 {
266 m_alwaysRun = value;
267 }
253 } 268 }
254 269
255 public override uint LocalID 270 public override uint LocalID
256 { 271 {
257 get { return m_localID; } 272 get
258 set { m_localID = value; } 273 {
274 return m_localID;
275 }
276 set
277 {
278 m_localID = value;
279 }
259 } 280 }
260 281
261 public override PhysicsActor ParentActor 282 public override PhysicsActor ParentActor
262 { 283 {
263 get { return (PhysicsActor)this; } 284 get
285 {
286 return (PhysicsActor)this;
287 }
264 } 288 }
265 289
266 public override bool Grabbed 290 public override bool Grabbed
267 { 291 {
268 set { return; } 292 set
293 {
294 return;
295 }
269 } 296 }
270 297
271 public override bool Selected 298 public override bool Selected
272 { 299 {
273 set { return; } 300 set
301 {
302 return;
303 }
274 } 304 }
275 305
276 public override float Buoyancy 306 public override float Buoyancy
277 { 307 {
278 get { return m_buoyancy; } 308 get
279 set { m_buoyancy = value; } 309 {
310 return m_buoyancy;
311 }
312 set
313 {
314 m_buoyancy = value;
315 }
280 } 316 }
281 317
282 public override bool FloatOnWater 318 public override bool FloatOnWater
283 { 319 {
284 set { return; } 320 set
321 {
322 return;
323 }
285 } 324 }
286 325
287 public override bool IsPhysical 326 public override bool IsPhysical
288 { 327 {
289 get { return m_isPhysical; } 328 get
290 set { return; } 329 {
330 return m_isPhysical;
331 }
332 set
333 {
334 return;
335 }
291 } 336 }
292 337
293 public override bool ThrottleUpdates 338 public override bool ThrottleUpdates
294 { 339 {
295 get { return false; } 340 get
296 set { return; } 341 {
342 return false;
343 }
344 set
345 {
346 return;
347 }
297 } 348 }
298 349
299 public override bool Flying 350 public override bool Flying
300 { 351 {
301 get { return m_flying; } 352 get
353 {
354 return m_flying;
355 }
302 set 356 set
303 { 357 {
304 m_flying = value; 358 m_flying = value;
305// m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying); 359 // m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying);
306 } 360 }
307 } 361 }
308 362
@@ -312,23 +366,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde
312 /// </summary> 366 /// </summary>
313 public override bool IsColliding 367 public override bool IsColliding
314 { 368 {
315 get { return (m_iscolliding || m_iscollidingGround); } 369 get
370 {
371 return (m_iscolliding || m_iscollidingGround);
372 }
316 set 373 set
317 { 374 {
318 if (value) 375 if(value)
319 { 376 {
320 m_colliderfilter += 3; 377 m_colliderfilter += 3;
321 if (m_colliderfilter > 3) 378 if(m_colliderfilter > 3)
322 m_colliderfilter = 3; 379 m_colliderfilter = 3;
323 } 380 }
324 else 381 else
325 { 382 {
326 m_colliderfilter--; 383 m_colliderfilter--;
327 if (m_colliderfilter < 0) 384 if(m_colliderfilter < 0)
328 m_colliderfilter = 0; 385 m_colliderfilter = 0;
329 } 386 }
330 387
331 if (m_colliderfilter == 0) 388 if(m_colliderfilter == 0)
332 m_iscolliding = false; 389 m_iscolliding = false;
333 else 390 else
334 { 391 {
@@ -344,28 +401,31 @@ namespace OpenSim.Region.PhysicsModule.ubOde
344 /// </summary> 401 /// </summary>
345 public override bool CollidingGround 402 public override bool CollidingGround
346 { 403 {
347 get { return m_iscollidingGround; } 404 get
405 {
406 return m_iscollidingGround;
407 }
348 set 408 set
349 { 409 {
350/* we now control this 410 /* we now control this
351 if (value) 411 if (value)
352 { 412 {
353 m_colliderGroundfilter += 2; 413 m_colliderGroundfilter += 2;
354 if (m_colliderGroundfilter > 2) 414 if (m_colliderGroundfilter > 2)
355 m_colliderGroundfilter = 2; 415 m_colliderGroundfilter = 2;
356 } 416 }
357 else 417 else
358 { 418 {
359 m_colliderGroundfilter--; 419 m_colliderGroundfilter--;
360 if (m_colliderGroundfilter < 0) 420 if (m_colliderGroundfilter < 0)
361 m_colliderGroundfilter = 0; 421 m_colliderGroundfilter = 0;
362 } 422 }
363 423
364 if (m_colliderGroundfilter == 0) 424 if (m_colliderGroundfilter == 0)
365 m_iscollidingGround = false; 425 m_iscollidingGround = false;
366 else 426 else
367 m_iscollidingGround = true; 427 m_iscollidingGround = true;
368 */ 428 */
369 } 429 }
370 430
371 } 431 }
@@ -375,31 +435,34 @@ namespace OpenSim.Region.PhysicsModule.ubOde
375 /// </summary> 435 /// </summary>
376 public override bool CollidingObj 436 public override bool CollidingObj
377 { 437 {
378 get { return m_iscollidingObj; } 438 get
439 {
440 return m_iscollidingObj;
441 }
379 set 442 set
380 { 443 {
381 // Ubit filter this also 444 // Ubit filter this also
382 if (value) 445 if(value)
383 { 446 {
384 m_colliderObjectfilter += 2; 447 m_colliderObjectfilter += 2;
385 if (m_colliderObjectfilter > 2) 448 if(m_colliderObjectfilter > 2)
386 m_colliderObjectfilter = 2; 449 m_colliderObjectfilter = 2;
387 } 450 }
388 else 451 else
389 { 452 {
390 m_colliderObjectfilter--; 453 m_colliderObjectfilter--;
391 if (m_colliderObjectfilter < 0) 454 if(m_colliderObjectfilter < 0)
392 m_colliderObjectfilter = 0; 455 m_colliderObjectfilter = 0;
393 } 456 }
394 457
395 if (m_colliderObjectfilter == 0) 458 if(m_colliderObjectfilter == 0)
396 m_iscollidingObj = false; 459 m_iscollidingObj = false;
397 else 460 else
398 m_iscollidingObj = true; 461 m_iscollidingObj = true;
399 462
400// m_iscollidingObj = value; 463 // m_iscollidingObj = value;
401 464
402 if (m_iscollidingObj) 465 if(m_iscollidingObj)
403 m_pidControllerActive = false; 466 m_pidControllerActive = false;
404 else 467 else
405 m_pidControllerActive = true; 468 m_pidControllerActive = true;
@@ -418,7 +481,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
418 481
419 public override bool Stopped 482 public override bool Stopped
420 { 483 {
421 get { return _zeroFlag; } 484 get
485 {
486 return _zeroFlag;
487 }
422 } 488 }
423 489
424 /// <summary> 490 /// <summary>
@@ -428,20 +494,23 @@ namespace OpenSim.Region.PhysicsModule.ubOde
428 /// </summary> 494 /// </summary>
429 public override Vector3 Position 495 public override Vector3 Position
430 { 496 {
431 get { return _position; } 497 get
498 {
499 return _position;
500 }
432 set 501 set
433 { 502 {
434 if (value.IsFinite()) 503 if(value.IsFinite())
435 { 504 {
436 if (value.Z > 9999999f) 505 if(value.Z > 9999999f)
437 { 506 {
438 value.Z = m_parent_scene.GetTerrainHeightAtXY(127, 127) + 5; 507 value.Z = m_parent_scene.GetTerrainHeightAtXY(127,127) + 5;
439 } 508 }
440 if (value.Z < -100f) 509 if(value.Z < -100f)
441 { 510 {
442 value.Z = m_parent_scene.GetTerrainHeightAtXY(127, 127) + 5; 511 value.Z = m_parent_scene.GetTerrainHeightAtXY(127,127) + 5;
443 } 512 }
444 AddChange(changes.Position, value); 513 AddChange(changes.Position,value);
445 } 514 }
446 else 515 else
447 { 516 {
@@ -452,8 +521,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
452 521
453 public override Vector3 RotationalVelocity 522 public override Vector3 RotationalVelocity
454 { 523 {
455 get { return m_rotationalVelocity; } 524 get
456 set { m_rotationalVelocity = value; } 525 {
526 return m_rotationalVelocity;
527 }
528 set
529 {
530 m_rotationalVelocity = value;
531 }
457 } 532 }
458 533
459 /// <summary> 534 /// <summary>
@@ -468,7 +543,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
468 } 543 }
469 set 544 set
470 { 545 {
471 if (value.IsFinite()) 546 if(value.IsFinite())
472 { 547 {
473 if(value.X <0.01f) 548 if(value.X <0.01f)
474 value.X = 0.01f; 549 value.X = 0.01f;
@@ -477,7 +552,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
477 if(value.Z <0.01f) 552 if(value.Z <0.01f)
478 value.Z = 0.01f; 553 value.Z = 0.01f;
479 554
480 AddChange(changes.Size, value); 555 AddChange(changes.Size,value);
481 } 556 }
482 else 557 else
483 { 558 {
@@ -486,21 +561,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde
486 } 561 }
487 } 562 }
488 563
489 public override void setAvatarSize(Vector3 size, float feetOffset) 564 public override void setAvatarSize(Vector3 size,float feetOffset)
490 { 565 {
491 if (size.IsFinite()) 566 if(size.IsFinite())
492 { 567 {
493 if (size.X < 0.01f) 568 if(size.X < 0.01f)
494 size.X = 0.01f; 569 size.X = 0.01f;
495 if (size.Y < 0.01f) 570 if(size.Y < 0.01f)
496 size.Y = 0.01f; 571 size.Y = 0.01f;
497 if (size.Z < 0.01f) 572 if(size.Z < 0.01f)
498 size.Z = 0.01f; 573 size.Z = 0.01f;
499 574
500 strAvatarSize st = new strAvatarSize(); 575 strAvatarSize st = new strAvatarSize();
501 st.size = size; 576 st.size = size;
502 st.offset = feetOffset; 577 st.offset = feetOffset;
503 AddChange(changes.AvatarSize, st); 578 AddChange(changes.AvatarSize,st);
504 } 579 }
505 else 580 else
506 { 581 {
@@ -545,32 +620,44 @@ namespace OpenSim.Region.PhysicsModule.ubOde
545 620
546 public override Vector3 Force 621 public override Vector3 Force
547 { 622 {
548 get { return _target_velocity; } 623 get
549 set { return; } 624 {
625 return _target_velocity;
626 }
627 set
628 {
629 return;
630 }
550 } 631 }
551 632
552 public override int VehicleType 633 public override int VehicleType
553 { 634 {
554 get { return 0; } 635 get
555 set { return; } 636 {
637 return 0;
638 }
639 set
640 {
641 return;
642 }
556 } 643 }
557 644
558 public override void VehicleFloatParam(int param, float value) 645 public override void VehicleFloatParam(int param,float value)
559 { 646 {
560 647
561 } 648 }
562 649
563 public override void VehicleVectorParam(int param, Vector3 value) 650 public override void VehicleVectorParam(int param,Vector3 value)
564 { 651 {
565 652
566 } 653 }
567 654
568 public override void VehicleRotationParam(int param, Quaternion rotation) 655 public override void VehicleRotationParam(int param,Quaternion rotation)
569 { 656 {
570 657
571 } 658 }
572 659
573 public override void VehicleFlags(int param, bool remove) 660 public override void VehicleFlags(int param,bool remove)
574 { 661 {
575 662
576 } 663 }
@@ -600,7 +687,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
600 687
601 public override PrimitiveBaseShape Shape 688 public override PrimitiveBaseShape Shape
602 { 689 {
603 set { return; } 690 set
691 {
692 return;
693 }
604 } 694 }
605 695
606 public override Vector3 rootVelocity 696 public override Vector3 rootVelocity
@@ -619,9 +709,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
619 } 709 }
620 set 710 set
621 { 711 {
622 if (value.IsFinite()) 712 if(value.IsFinite())
623 { 713 {
624 AddChange(changes.Velocity, value); 714 AddChange(changes.Velocity,value);
625 } 715 }
626 else 716 else
627 { 717 {
@@ -638,9 +728,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
638 } 728 }
639 set 729 set
640 { 730 {
641 if (value.IsFinite()) 731 if(value.IsFinite())
642 { 732 {
643 AddChange(changes.TargetVelocity, value); 733 AddChange(changes.TargetVelocity,value);
644 } 734 }
645 else 735 else
646 { 736 {
@@ -651,38 +741,62 @@ namespace OpenSim.Region.PhysicsModule.ubOde
651 741
652 public override Vector3 Torque 742 public override Vector3 Torque
653 { 743 {
654 get { return Vector3.Zero; } 744 get
655 set { return; } 745 {
746 return Vector3.Zero;
747 }
748 set
749 {
750 return;
751 }
656 } 752 }
657 753
658 public override float CollisionScore 754 public override float CollisionScore
659 { 755 {
660 get { return 0f; } 756 get
661 set { } 757 {
758 return 0f;
759 }
760 set
761 {
762 }
662 } 763 }
663 764
664 public override bool Kinematic 765 public override bool Kinematic
665 { 766 {
666 get { return false; } 767 get
667 set { } 768 {
769 return false;
770 }
771 set
772 {
773 }
668 } 774 }
669 775
670 public override Quaternion Orientation 776 public override Quaternion Orientation
671 { 777 {
672 get { return m_orientation; } 778 get
779 {
780 return m_orientation;
781 }
673 set 782 set
674 { 783 {
675// fakeori = value; 784 // fakeori = value;
676// givefakeori++; 785 // givefakeori++;
677 value.Normalize(); 786 value.Normalize();
678 AddChange(changes.Orientation, value); 787 AddChange(changes.Orientation,value);
679 } 788 }
680 } 789 }
681 790
682 public override Vector3 Acceleration 791 public override Vector3 Acceleration
683 { 792 {
684 get { return _acceleration; } 793 get
685 set { } 794 {
795 return _acceleration;
796 }
797 set
798 {
799 }
686 } 800 }
687 801
688 public void SetAcceleration(Vector3 accel) 802 public void SetAcceleration(Vector3 accel)
@@ -696,17 +810,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
696 /// The PID controller takes this target velocity and tries to make it a reality 810 /// The PID controller takes this target velocity and tries to make it a reality
697 /// </summary> 811 /// </summary>
698 /// <param name="force"></param> 812 /// <param name="force"></param>
699 public override void AddForce(Vector3 force, bool pushforce) 813 public override void AddForce(Vector3 force,bool pushforce)
700 { 814 {
701 if (force.IsFinite()) 815 if(force.IsFinite())
702 { 816 {
703 if (pushforce) 817 if(pushforce)
704 { 818 {
705 AddChange(changes.Force, force * m_density / (m_parent_scene.ODE_STEPSIZE * 28f)); 819 AddChange(changes.Force,force * m_density / (m_parent_scene.ODE_STEPSIZE * 28f));
706 } 820 }
707 else 821 else
708 { 822 {
709 AddChange(changes.TargetVelocity, force); 823 AddChange(changes.TargetVelocity,force);
710 } 824 }
711 } 825 }
712 else 826 else
@@ -716,19 +830,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
716 //m_lastUpdateSent = false; 830 //m_lastUpdateSent = false;
717 } 831 }
718 832
719 public override void AddAngularForce(Vector3 force, bool pushforce) 833 public override void AddAngularForce(Vector3 force,bool pushforce)
720 { 834 {
721 835
722 } 836 }
723 837
724 public override void SetMomentum(Vector3 momentum) 838 public override void SetMomentum(Vector3 momentum)
725 { 839 {
726 if (momentum.IsFinite()) 840 if(momentum.IsFinite())
727 AddChange(changes.Momentum, momentum); 841 AddChange(changes.Momentum,momentum);
728 } 842 }
729 843
730 844
731 private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ) 845 private void AvatarGeomAndBodyCreation(float npositionX,float npositionY,float npositionZ)
732 { 846 {
733 // sizes one day should came from visual parameters 847 // sizes one day should came from visual parameters
734 float sx = m_size.X; 848 float sx = m_size.X;
@@ -739,7 +853,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
739 boneOff = bot + 0.3f; 853 boneOff = bot + 0.3f;
740 854
741 float feetsz = sz * 0.45f; 855 float feetsz = sz * 0.45f;
742 if (feetsz > 0.6f) 856 if(feetsz > 0.6f)
743 feetsz = 0.6f; 857 feetsz = 0.6f;
744 858
745 feetOff = bot + feetsz; 859 feetOff = bot + feetsz;
@@ -751,29 +865,28 @@ namespace OpenSim.Region.PhysicsModule.ubOde
751 865
752 m_parent_scene.waitForSpaceUnlock(m_parent_scene.CharsSpace); 866 m_parent_scene.waitForSpaceUnlock(m_parent_scene.CharsSpace);
753 867
754 collider = d.HashSpaceCreate(m_parent_scene.CharsSpace); 868 collider = SafeNativeMethods.SimpleSpaceCreate(m_parent_scene.CharsSpace);
755 d.HashSpaceSetLevels(collider, -4, 3); 869 SafeNativeMethods.SpaceSetSublevel(collider,3);
756 d.SpaceSetSublevel(collider, 3); 870 SafeNativeMethods.SpaceSetCleanup(collider,false);
757 d.SpaceSetCleanup(collider, false); 871 SafeNativeMethods.GeomSetCategoryBits(collider,(uint)m_collisionCategories);
758 d.GeomSetCategoryBits(collider, (uint)m_collisionCategories); 872 SafeNativeMethods.GeomSetCollideBits(collider,(uint)m_collisionFlags);
759 d.GeomSetCollideBits(collider, (uint)m_collisionFlags);
760 873
761 float r = m_size.X; 874 float r = m_size.X;
762 if (m_size.Y > r) 875 if(m_size.Y > r)
763 r = m_size.Y; 876 r = m_size.Y;
764 float l = m_size.Z - r; 877 float l = m_size.Z - r;
765 r *= 0.5f; 878 r *= 0.5f;
766 879
767 capsule = d.CreateCapsule(collider, r, l); 880 capsule = SafeNativeMethods.CreateCapsule(collider,r,l);
768 881
769 m_mass = m_density * m_size.X * m_size.Y * m_size.Z; // update mass 882 m_mass = m_density * m_size.X * m_size.Y * m_size.Z; // update mass
770 883
771 d.MassSetBoxTotal(out ShellMass, m_mass, m_size.X, m_size.Y, m_size.Z); 884 SafeNativeMethods.MassSetBoxTotal(out ShellMass,m_mass,m_size.X,m_size.Y,m_size.Z);
772 885
773 PID_D = basePID_D * m_mass / m_parent_scene.ODE_STEPSIZE; 886 PID_D = basePID_D * m_mass / m_parent_scene.ODE_STEPSIZE;
774 PID_P = basePID_P * m_mass / m_parent_scene.ODE_STEPSIZE; 887 PID_P = basePID_P * m_mass / m_parent_scene.ODE_STEPSIZE;
775 888
776 Body = d.BodyCreate(m_parent_scene.world); 889 Body = SafeNativeMethods.BodyCreate(m_parent_scene.world);
777 890
778 _zeroFlag = false; 891 _zeroFlag = false;
779 m_pidControllerActive = true; 892 m_pidControllerActive = true;
@@ -781,53 +894,53 @@ namespace OpenSim.Region.PhysicsModule.ubOde
781 894
782 _velocity = Vector3.Zero; 895 _velocity = Vector3.Zero;
783 896
784 d.BodySetAutoDisableFlag(Body, false); 897 SafeNativeMethods.BodySetAutoDisableFlag(Body,false);
785 d.BodySetPosition(Body, npositionX, npositionY, npositionZ); 898 SafeNativeMethods.BodySetPosition(Body,npositionX,npositionY,npositionZ);
786 899
787 _position.X = npositionX; 900 _position.X = npositionX;
788 _position.Y = npositionY; 901 _position.Y = npositionY;
789 _position.Z = npositionZ; 902 _position.Z = npositionZ;
790 903
791 d.BodySetMass(Body, ref ShellMass); 904 SafeNativeMethods.BodySetMass(Body,ref ShellMass);
792 d.GeomSetBody(capsule, Body); 905 SafeNativeMethods.GeomSetBody(capsule,Body);
793 906
794 // The purpose of the AMotor here is to keep the avatar's physical 907 // The purpose of the AMotor here is to keep the avatar's physical
795 // surrogate from rotating while moving 908 // surrogate from rotating while moving
796 Amotor = d.JointCreateAMotor(m_parent_scene.world, IntPtr.Zero); 909 Amotor = SafeNativeMethods.JointCreateAMotor(m_parent_scene.world,IntPtr.Zero);
797 d.JointAttach(Amotor, Body, IntPtr.Zero); 910 SafeNativeMethods.JointAttach(Amotor,Body,IntPtr.Zero);
798 911
799 d.JointSetAMotorMode(Amotor, 0); 912 SafeNativeMethods.JointSetAMotorMode(Amotor,0);
800 d.JointSetAMotorNumAxes(Amotor, 3); 913 SafeNativeMethods.JointSetAMotorNumAxes(Amotor,3);
801 d.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0); 914 SafeNativeMethods.JointSetAMotorAxis(Amotor,0,0,1,0,0);
802 d.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0); 915 SafeNativeMethods.JointSetAMotorAxis(Amotor,1,0,0,1,0);
803 d.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1); 916 SafeNativeMethods.JointSetAMotorAxis(Amotor,2,0,0,0,1);
804 917
805 d.JointSetAMotorAngle(Amotor, 0, 0); 918 SafeNativeMethods.JointSetAMotorAngle(Amotor,0,0);
806 d.JointSetAMotorAngle(Amotor, 1, 0); 919 SafeNativeMethods.JointSetAMotorAngle(Amotor,1,0);
807 d.JointSetAMotorAngle(Amotor, 2, 0); 920 SafeNativeMethods.JointSetAMotorAngle(Amotor,2,0);
808 921
809 d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0f); // make it HARD 922 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopCFM,0f); // make it HARD
810 d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0f); 923 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopCFM2,0f);
811 d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0f); 924 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopCFM3,0f);
812 d.JointSetAMotorParam(Amotor, (int)dParam.StopERP, 0.8f); 925 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopERP,0.8f);
813 d.JointSetAMotorParam(Amotor, (int)dParam.StopERP2, 0.8f); 926 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopERP2,0.8f);
814 d.JointSetAMotorParam(Amotor, (int)dParam.StopERP3, 0.8f); 927 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopERP3,0.8f);
815 928
816 // These lowstops and high stops are effectively (no wiggle room) 929 // These lowstops and high stops are effectively (no wiggle room)
817 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -1e-5f); 930 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.LowStop,-1e-5f);
818 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 1e-5f); 931 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.HiStop,1e-5f);
819 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -1e-5f); 932 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.LoStop2,-1e-5f);
820 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 1e-5f); 933 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.HiStop2,1e-5f);
821 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -1e-5f); 934 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.LoStop3,-1e-5f);
822 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 1e-5f); 935 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.HiStop3,1e-5f);
823 936
824 d.JointSetAMotorParam(Amotor, (int)d.JointParam.Vel, 0); 937 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)SafeNativeMethods.JointParam.Vel,0);
825 d.JointSetAMotorParam(Amotor, (int)d.JointParam.Vel2, 0); 938 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)SafeNativeMethods.JointParam.Vel2,0);
826 d.JointSetAMotorParam(Amotor, (int)d.JointParam.Vel3, 0); 939 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)SafeNativeMethods.JointParam.Vel3,0);
827 940
828 d.JointSetAMotorParam(Amotor, (int)dParam.FMax, 5e8f); 941 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.FMax,5e8f);
829 d.JointSetAMotorParam(Amotor, (int)dParam.FMax2, 5e8f); 942 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.FMax2,5e8f);
830 d.JointSetAMotorParam(Amotor, (int)dParam.FMax3, 5e8f); 943 SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.FMax3,5e8f);
831 } 944 }
832 945
833 /// <summary> 946 /// <summary>
@@ -836,38 +949,38 @@ namespace OpenSim.Region.PhysicsModule.ubOde
836 private void AvatarGeomAndBodyDestroy() 949 private void AvatarGeomAndBodyDestroy()
837 { 950 {
838 // Kill the Amotor 951 // Kill the Amotor
839 if (Amotor != IntPtr.Zero) 952 if(Amotor != IntPtr.Zero)
840 { 953 {
841 d.JointDestroy(Amotor); 954 SafeNativeMethods.JointDestroy(Amotor);
842 Amotor = IntPtr.Zero; 955 Amotor = IntPtr.Zero;
843 } 956 }
844 957
845 if (Body != IntPtr.Zero) 958 if(Body != IntPtr.Zero)
846 { 959 {
847 //kill the body 960 //kill the body
848 d.BodyDestroy(Body); 961 SafeNativeMethods.BodyDestroy(Body);
849 Body = IntPtr.Zero; 962 Body = IntPtr.Zero;
850 } 963 }
851 964
852 //kill the Geoms 965 //kill the Geoms
853 if (capsule != IntPtr.Zero) 966 if(capsule != IntPtr.Zero)
854 { 967 {
855 m_parent_scene.actor_name_map.Remove(capsule); 968 m_parent_scene.actor_name_map.Remove(capsule);
856 m_parent_scene.waitForSpaceUnlock(collider); 969 m_parent_scene.waitForSpaceUnlock(collider);
857 d.GeomDestroy(capsule); 970 SafeNativeMethods.GeomDestroy(capsule);
858 capsule = IntPtr.Zero; 971 capsule = IntPtr.Zero;
859 } 972 }
860 973
861 if (collider != IntPtr.Zero) 974 if(collider != IntPtr.Zero)
862 { 975 {
863 d.SpaceDestroy(collider); 976 SafeNativeMethods.SpaceDestroy(collider);
864 collider = IntPtr.Zero; 977 collider = IntPtr.Zero;
865 } 978 }
866 979
867 } 980 }
868 981
869 //in place 2D rotation around Z assuming rot is normalised and is a rotation around Z 982 //in place 2D rotation around Z assuming rot is normalised and is a rotation around Z
870 public void RotateXYonZ(ref float x, ref float y, ref Quaternion rot) 983 public void RotateXYonZ(ref float x,ref float y,ref Quaternion rot)
871 { 984 {
872 float sin = 2.0f * rot.Z * rot.W; 985 float sin = 2.0f * rot.Z * rot.W;
873 float cos = rot.W * rot.W - rot.Z * rot.Z; 986 float cos = rot.W * rot.W - rot.Z * rot.Z;
@@ -876,22 +989,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde
876 x = tx * cos - y * sin; 989 x = tx * cos - y * sin;
877 y = tx * sin + y * cos; 990 y = tx * sin + y * cos;
878 } 991 }
879 public void RotateXYonZ(ref float x, ref float y, ref float sin, ref float cos) 992 public void RotateXYonZ(ref float x,ref float y,ref float sin,ref float cos)
880 { 993 {
881 float tx = x; 994 float tx = x;
882 x = tx * cos - y * sin; 995 x = tx * cos - y * sin;
883 y = tx * sin + y * cos; 996 y = tx * sin + y * cos;
884 } 997 }
885 public void invRotateXYonZ(ref float x, ref float y, ref float sin, ref float cos) 998 public void invRotateXYonZ(ref float x,ref float y,ref float sin,ref float cos)
886 { 999 {
887 float tx = x; 1000 float tx = x;
888 x = tx * cos + y * sin; 1001 x = tx * cos + y * sin;
889 y = -tx * sin + y * cos; 1002 y = -tx * sin + y * cos;
890 } 1003 }
891 1004
892 public void invRotateXYonZ(ref float x, ref float y, ref Quaternion rot) 1005 public void invRotateXYonZ(ref float x,ref float y,ref Quaternion rot)
893 { 1006 {
894 float sin = - 2.0f * rot.Z * rot.W; 1007 float sin = -2.0f * rot.Z * rot.W;
895 float cos = rot.W * rot.W - rot.Z * rot.Z; 1008 float cos = rot.W * rot.W - rot.Z * rot.Z;
896 float tx = x; 1009 float tx = x;
897 1010
@@ -899,13 +1012,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
899 y = tx * sin + y * cos; 1012 y = tx * sin + y * cos;
900 } 1013 }
901 1014
902 public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact, 1015 internal bool Collide(IntPtr me,IntPtr other,bool reverse,ref SafeNativeMethods.ContactGeom contact,
903 ref d.ContactGeom altContact , ref bool useAltcontact, ref bool feetcollision) 1016 ref SafeNativeMethods.ContactGeom altContact,ref bool useAltcontact,ref bool feetcollision)
904 { 1017 {
905 feetcollision = false; 1018 feetcollision = false;
906 useAltcontact = false; 1019 useAltcontact = false;
907 1020
908 if (me == capsule) 1021 if(me == capsule)
909 { 1022 {
910 Vector3 offset; 1023 Vector3 offset;
911 1024
@@ -915,25 +1028,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde
915 offset.X = contact.pos.X - _position.X; 1028 offset.X = contact.pos.X - _position.X;
916 offset.Y = contact.pos.Y - _position.Y; 1029 offset.Y = contact.pos.Y - _position.Y;
917 1030
918 d.GeomClassID gtype = d.GeomGetClass(other); 1031 SafeNativeMethods.GeomClassID gtype = SafeNativeMethods.GeomGetClass(other);
919 if (gtype == d.GeomClassID.CapsuleClass) 1032 if(gtype == SafeNativeMethods.GeomClassID.CapsuleClass)
920 { 1033 {
921 Vector3 roff = offset * Quaternion.Inverse(m_orientation2D); 1034 Vector3 roff = offset * Quaternion.Inverse(m_orientation2D);
922 float r = roff.X *roff.X / AvaAvaSizeXsq; 1035 float r = roff.X *roff.X / AvaAvaSizeXsq;
923 r += (roff.Y * roff.Y) / AvaAvaSizeYsq; 1036 r += (roff.Y * roff.Y) / AvaAvaSizeYsq;
924 if (r > 1.0f) 1037 if(r > 1.0f)
925 return false; 1038 return false;
926 1039
927 float dp = 1.0f -(float)Math.Sqrt((double)r); 1040 float dp = 1.0f -(float)Math.Sqrt((double)r);
928 if (dp > 0.05f) 1041 if(dp > 0.05f)
929 dp = 0.05f; 1042 dp = 0.05f;
930 1043
931 contact.depth = dp; 1044 contact.depth = dp;
932 1045
933 if (offset.Z < 0) 1046 if(offset.Z < 0)
934 { 1047 {
935 feetcollision = true; 1048 feetcollision = true;
936 if (h < boneOff) 1049 if(h < boneOff)
937 { 1050 {
938 m_collideNormal.X = contact.normal.X; 1051 m_collideNormal.X = contact.normal.X;
939 m_collideNormal.Y = contact.normal.Y; 1052 m_collideNormal.Y = contact.normal.Y;
@@ -944,18 +1057,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
944 return true; 1057 return true;
945 } 1058 }
946 1059
947 if (gtype == d.GeomClassID.SphereClass && d.GeomGetBody(other) != IntPtr.Zero) 1060 if(gtype == SafeNativeMethods.GeomClassID.SphereClass && SafeNativeMethods.GeomGetBody(other) != IntPtr.Zero)
948 { 1061 {
949 if(d.GeomSphereGetRadius(other) < 0.5) 1062 if(SafeNativeMethods.GeomSphereGetRadius(other) < 0.5)
950 return true; 1063 return true;
951 } 1064 }
952 1065
953 if (offset.Z > 0 || contact.normal.Z > 0.35f) 1066 if(offset.Z > 0 || contact.normal.Z > 0.35f)
954 { 1067 {
955 if (offset.Z <= 0) 1068 if(offset.Z <= 0)
956 { 1069 {
957 feetcollision = true; 1070 feetcollision = true;
958 if (h < boneOff) 1071 if(h < boneOff)
959 { 1072 {
960 m_collideNormal.X = contact.normal.X; 1073 m_collideNormal.X = contact.normal.X;
961 m_collideNormal.Y = contact.normal.Y; 1074 m_collideNormal.Y = contact.normal.Y;
@@ -970,7 +1083,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
970 return true; 1083 return true;
971 1084
972 feetcollision = true; 1085 feetcollision = true;
973 if (h < boneOff) 1086 if(h < boneOff)
974 { 1087 {
975 m_collideNormal.X = contact.normal.X; 1088 m_collideNormal.X = contact.normal.X;
976 m_collideNormal.Y = contact.normal.Y; 1089 m_collideNormal.Y = contact.normal.Y;
@@ -990,18 +1103,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
990 t = Math.Abs(t); 1103 t = Math.Abs(t);
991 if(t > 1e-6) 1104 if(t > 1e-6)
992 { 1105 {
993 tdp /= t; 1106 tdp /= t;
994 tdp *= contact.normal.X; 1107 tdp *= contact.normal.X;
995 } 1108 }
996 else 1109 else
997 tdp *= 10; 1110 tdp *= 10;
998 1111
999 if (tdp > 0.25f) 1112 if(tdp > 0.25f)
1000 tdp = 0.25f; 1113 tdp = 0.25f;
1001 1114
1002 altContact.depth = tdp; 1115 altContact.depth = tdp;
1003 1116
1004 if (reverse) 1117 if(reverse)
1005 { 1118 {
1006 altContact.normal.X = offset.X; 1119 altContact.normal.X = offset.X;
1007 altContact.normal.Y = offset.Y; 1120 altContact.normal.Y = offset.Y;
@@ -1025,28 +1138,28 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1025 /// <param name="timeStep"></param> 1138 /// <param name="timeStep"></param>
1026 public void Move(List<OdeCharacter> defects) 1139 public void Move(List<OdeCharacter> defects)
1027 { 1140 {
1028 if (Body == IntPtr.Zero) 1141 if(Body == IntPtr.Zero)
1029 return; 1142 return;
1030 1143
1031 d.Vector3 dtmp = d.BodyGetPosition(Body); 1144 SafeNativeMethods.Vector3 dtmp = SafeNativeMethods.BodyGetPosition(Body);
1032 Vector3 localpos = new Vector3(dtmp.X, dtmp.Y, dtmp.Z); 1145 Vector3 localpos = new Vector3(dtmp.X,dtmp.Y,dtmp.Z);
1033 1146
1034 // the Amotor still lets avatar rotation to drift during colisions 1147 // the Amotor still lets avatar rotation to drift during colisions
1035 // so force it back to identity 1148 // so force it back to identity
1036 1149
1037 d.Quaternion qtmp; 1150 SafeNativeMethods.Quaternion qtmp;
1038 qtmp.W = m_orientation2D.W; 1151 qtmp.W = m_orientation2D.W;
1039 qtmp.X = m_orientation2D.X; 1152 qtmp.X = m_orientation2D.X;
1040 qtmp.Y = m_orientation2D.Y; 1153 qtmp.Y = m_orientation2D.Y;
1041 qtmp.Z = m_orientation2D.Z; 1154 qtmp.Z = m_orientation2D.Z;
1042 d.BodySetQuaternion(Body, ref qtmp); 1155 SafeNativeMethods.BodySetQuaternion(Body,ref qtmp);
1043 1156
1044 if (m_pidControllerActive == false) 1157 if(m_pidControllerActive == false)
1045 { 1158 {
1046 _zeroPosition = localpos; 1159 _zeroPosition = localpos;
1047 } 1160 }
1048 1161
1049 if (!localpos.IsFinite()) 1162 if(!localpos.IsFinite())
1050 { 1163 {
1051 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); 1164 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!");
1052 defects.Add(this); 1165 defects.Add(this);
@@ -1059,44 +1172,44 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1059 1172
1060 // check outbounds forcing to be in world 1173 // check outbounds forcing to be in world
1061 bool fixbody = false; 1174 bool fixbody = false;
1062 if (localpos.X < 0.0f) 1175 if(localpos.X < 0.0f)
1063 { 1176 {
1064 fixbody = true; 1177 fixbody = true;
1065 localpos.X = 0.1f; 1178 localpos.X = 0.1f;
1066 } 1179 }
1067 else if (localpos.X > m_parent_scene.WorldExtents.X - 0.1f) 1180 else if(localpos.X > m_parent_scene.WorldExtents.X - 0.1f)
1068 { 1181 {
1069 fixbody = true; 1182 fixbody = true;
1070 localpos.X = m_parent_scene.WorldExtents.X - 0.1f; 1183 localpos.X = m_parent_scene.WorldExtents.X - 0.1f;
1071 } 1184 }
1072 if (localpos.Y < 0.0f) 1185 if(localpos.Y < 0.0f)
1073 { 1186 {
1074 fixbody = true; 1187 fixbody = true;
1075 localpos.Y = 0.1f; 1188 localpos.Y = 0.1f;
1076 } 1189 }
1077 else if (localpos.Y > m_parent_scene.WorldExtents.Y - 0.1) 1190 else if(localpos.Y > m_parent_scene.WorldExtents.Y - 0.1)
1078 { 1191 {
1079 fixbody = true; 1192 fixbody = true;
1080 localpos.Y = m_parent_scene.WorldExtents.Y - 0.1f; 1193 localpos.Y = m_parent_scene.WorldExtents.Y - 0.1f;
1081 } 1194 }
1082 if (fixbody) 1195 if(fixbody)
1083 { 1196 {
1084 m_freemove = false; 1197 m_freemove = false;
1085 d.BodySetPosition(Body, localpos.X, localpos.Y, localpos.Z); 1198 SafeNativeMethods.BodySetPosition(Body,localpos.X,localpos.Y,localpos.Z);
1086 } 1199 }
1087 1200
1088 float breakfactor; 1201 float breakfactor;
1089 1202
1090 Vector3 vec = Vector3.Zero; 1203 Vector3 vec = Vector3.Zero;
1091 dtmp = d.BodyGetLinearVel(Body); 1204 dtmp = SafeNativeMethods.BodyGetLinearVel(Body);
1092 Vector3 vel = new Vector3(dtmp.X, dtmp.Y, dtmp.Z); 1205 Vector3 vel = new Vector3(dtmp.X,dtmp.Y,dtmp.Z);
1093 float velLengthSquared = vel.LengthSquared(); 1206 float velLengthSquared = vel.LengthSquared();
1094 1207
1095 Vector3 ctz = _target_velocity; 1208 Vector3 ctz = _target_velocity;
1096 1209
1097 float movementdivisor = 1f; 1210 float movementdivisor = 1f;
1098 //Ubit change divisions into multiplications below 1211 //Ubit change divisions into multiplications below
1099 if (!m_alwaysRun) 1212 if(!m_alwaysRun)
1100 movementdivisor = 1 / walkDivisor; 1213 movementdivisor = 1 / walkDivisor;
1101 else 1214 else
1102 movementdivisor = 1 / runDivisor; 1215 movementdivisor = 1 / runDivisor;
@@ -1107,25 +1220,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1107 //****************************************** 1220 //******************************************
1108 // colide with land 1221 // colide with land
1109 1222
1110 d.AABB aabb; 1223 SafeNativeMethods.AABB aabb;
1111// d.GeomGetAABB(feetbox, out aabb); 1224 // d.GeomGetAABB(feetbox, out aabb);
1112 d.GeomGetAABB(capsule, out aabb); 1225 SafeNativeMethods.GeomGetAABB(capsule,out aabb);
1113 float chrminZ = aabb.MinZ; // move up a bit 1226 float chrminZ = aabb.MinZ; // move up a bit
1114 Vector3 posch = localpos; 1227 Vector3 posch = localpos;
1115 1228
1116 float ftmp; 1229 float ftmp;
1117 1230
1118 if (m_flying) 1231 if(m_flying)
1119 { 1232 {
1120 ftmp = timeStep; 1233 ftmp = timeStep;
1121 posch.X += vel.X * ftmp; 1234 posch.X += vel.X * ftmp;
1122 posch.Y += vel.Y * ftmp; 1235 posch.Y += vel.Y * ftmp;
1123 } 1236 }
1124 1237
1125 float terrainheight = m_parent_scene.GetTerrainHeightAtXY(posch.X, posch.Y); 1238 float terrainheight = m_parent_scene.GetTerrainHeightAtXY(posch.X,posch.Y);
1126 if (chrminZ < terrainheight) 1239 if(chrminZ < terrainheight)
1127 { 1240 {
1128 if (ctz.Z < 0) 1241 if(ctz.Z < 0)
1129 ctz.Z = 0; 1242 ctz.Z = 0;
1130 1243
1131 if(!m_haveLastFallVel) 1244 if(!m_haveLastFallVel)
@@ -1134,12 +1247,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1134 m_haveLastFallVel = true; 1247 m_haveLastFallVel = true;
1135 } 1248 }
1136 1249
1137 Vector3 n = m_parent_scene.GetTerrainNormalAtXY(posch.X, posch.Y); 1250 Vector3 n = m_parent_scene.GetTerrainNormalAtXY(posch.X,posch.Y);
1138 float depth = terrainheight - chrminZ; 1251 float depth = terrainheight - chrminZ;
1139 1252
1140 vec.Z = depth * PID_P * 50; 1253 vec.Z = depth * PID_P * 50;
1141 1254
1142 if (!m_flying) 1255 if(!m_flying)
1143 { 1256 {
1144 vec.Z += -vel.Z * PID_D; 1257 vec.Z += -vel.Z * PID_D;
1145 if(n.Z < 0.4f) 1258 if(n.Z < 0.4f)
@@ -1155,19 +1268,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1155 n.X = 0f; 1268 n.X = 0f;
1156 n.Y = 0f; 1269 n.Y = 0f;
1157 n.Z = 1.0f; 1270 n.Z = 1.0f;
1158 } 1271 }
1159 } 1272 }
1160 } 1273 }
1161 1274
1162 if (depth < 0.2f) 1275 if(depth < 0.2f)
1163 { 1276 {
1164 m_colliderGroundfilter++; 1277 m_colliderGroundfilter++;
1165 if (m_colliderGroundfilter > 2) 1278 if(m_colliderGroundfilter > 2)
1166 { 1279 {
1167 m_iscolliding = true; 1280 m_iscolliding = true;
1168 m_colliderfilter = 2; 1281 m_colliderfilter = 2;
1169 1282
1170 if (m_colliderGroundfilter > 10) 1283 if(m_colliderGroundfilter > 10)
1171 { 1284 {
1172 m_colliderGroundfilter = 10; 1285 m_colliderGroundfilter = 10;
1173 m_freemove = false; 1286 m_freemove = false;
@@ -1187,19 +1300,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1187 contact.SurfaceNormal.X = -n.X; 1300 contact.SurfaceNormal.X = -n.X;
1188 contact.SurfaceNormal.Y = -n.Y; 1301 contact.SurfaceNormal.Y = -n.Y;
1189 contact.SurfaceNormal.Z = -n.Z; 1302 contact.SurfaceNormal.Z = -n.Z;
1190 contact.RelativeSpeed = Vector3.Dot(m_lastFallVel, n); 1303 contact.RelativeSpeed = Vector3.Dot(m_lastFallVel,n);
1191 contact.CharacterFeet = true; 1304 contact.CharacterFeet = true;
1192 AddCollisionEvent(0, contact); 1305 AddCollisionEvent(0,contact);
1193 m_lastFallVel = vel; 1306 m_lastFallVel = vel;
1194 1307
1195// vec.Z *= 0.5f; 1308 // vec.Z *= 0.5f;
1196 } 1309 }
1197 } 1310 }
1198 1311
1199 else 1312 else
1200 { 1313 {
1201 m_colliderGroundfilter -= 5; 1314 m_colliderGroundfilter -= 5;
1202 if (m_colliderGroundfilter <= 0) 1315 if(m_colliderGroundfilter <= 0)
1203 { 1316 {
1204 m_colliderGroundfilter = 0; 1317 m_colliderGroundfilter = 0;
1205 m_iscollidingGround = false; 1318 m_iscollidingGround = false;
@@ -1210,7 +1323,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1210 { 1323 {
1211 m_haveLastFallVel = false; 1324 m_haveLastFallVel = false;
1212 m_colliderGroundfilter -= 5; 1325 m_colliderGroundfilter -= 5;
1213 if (m_colliderGroundfilter <= 0) 1326 if(m_colliderGroundfilter <= 0)
1214 { 1327 {
1215 m_colliderGroundfilter = 0; 1328 m_colliderGroundfilter = 0;
1216 m_iscollidingGround = false; 1329 m_iscollidingGround = false;
@@ -1219,11 +1332,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1219 1332
1220 bool hoverPIDActive = false; 1333 bool hoverPIDActive = false;
1221 1334
1222 if (m_useHoverPID && m_PIDHoverTau != 0 && m_PIDHoverHeight != 0) 1335 if(m_useHoverPID && m_PIDHoverTau != 0 && m_PIDHoverHeight != 0)
1223 { 1336 {
1224 hoverPIDActive = true; 1337 hoverPIDActive = true;
1225 1338
1226 switch (m_PIDHoverType) 1339 switch(m_PIDHoverType)
1227 { 1340 {
1228 case PIDHoverType.Ground: 1341 case PIDHoverType.Ground:
1229 m_targetHoverHeight = terrainheight + m_PIDHoverHeight; 1342 m_targetHoverHeight = terrainheight + m_PIDHoverHeight;
@@ -1231,20 +1344,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1231 1344
1232 case PIDHoverType.GroundAndWater: 1345 case PIDHoverType.GroundAndWater:
1233 float waterHeight = m_parent_scene.GetWaterLevel(); 1346 float waterHeight = m_parent_scene.GetWaterLevel();
1234 if (terrainheight > waterHeight) 1347 if(terrainheight > waterHeight)
1235 m_targetHoverHeight = terrainheight + m_PIDHoverHeight; 1348 m_targetHoverHeight = terrainheight + m_PIDHoverHeight;
1236 else 1349 else
1237 m_targetHoverHeight = waterHeight + m_PIDHoverHeight; 1350 m_targetHoverHeight = waterHeight + m_PIDHoverHeight;
1238 break; 1351 break;
1239 } // end switch (m_PIDHoverType) 1352 } // end switch (m_PIDHoverType)
1240 1353
1241 // don't go underground 1354 // don't go underground
1242 if (m_targetHoverHeight > terrainheight + 0.5f * (aabb.MaxZ - aabb.MinZ)) 1355 if(m_targetHoverHeight > terrainheight + 0.5f * (aabb.MaxZ - aabb.MinZ))
1243 { 1356 {
1244 float fz = (m_targetHoverHeight - localpos.Z); 1357 float fz = (m_targetHoverHeight - localpos.Z);
1245 1358
1246 // if error is zero, use position control; otherwise, velocity control 1359 // if error is zero, use position control; otherwise, velocity control
1247 if (Math.Abs(fz) < 0.01f) 1360 if(Math.Abs(fz) < 0.01f)
1248 { 1361 {
1249 ctz.Z = 0; 1362 ctz.Z = 0;
1250 } 1363 }
@@ -1254,9 +1367,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1254 fz /= m_PIDHoverTau; 1367 fz /= m_PIDHoverTau;
1255 1368
1256 float tmp = Math.Abs(fz); 1369 float tmp = Math.Abs(fz);
1257 if (tmp > 50) 1370 if(tmp > 50)
1258 fz = 50 * Math.Sign(fz); 1371 fz = 50 * Math.Sign(fz);
1259 else if (tmp < 0.1) 1372 else if(tmp < 0.1)
1260 fz = 0.1f * Math.Sign(fz); 1373 fz = 0.1f * Math.Sign(fz);
1261 1374
1262 ctz.Z = fz; 1375 ctz.Z = fz;
@@ -1265,43 +1378,43 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1265 } 1378 }
1266 1379
1267 //****************************************** 1380 //******************************************
1268 if (!m_iscolliding) 1381 if(!m_iscolliding)
1269 m_collideNormal.Z = 0; 1382 m_collideNormal.Z = 0;
1270 1383
1271 bool tviszero = (ctz.X == 0.0f && ctz.Y == 0.0f && ctz.Z == 0.0f); 1384 bool tviszero = (ctz.X == 0.0f && ctz.Y == 0.0f && ctz.Z == 0.0f);
1272 1385
1273 if (!tviszero) 1386 if(!tviszero)
1274 { 1387 {
1275 m_freemove = false; 1388 m_freemove = false;
1276 1389
1277 // movement relative to surface if moving on it 1390 // movement relative to surface if moving on it
1278 // dont disturbe vertical movement, ie jumps 1391 // dont disturbe vertical movement, ie jumps
1279 if (m_iscolliding && !m_flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f) 1392 if(m_iscolliding && !m_flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f)
1280 { 1393 {
1281 float p = ctz.X * m_collideNormal.X + ctz.Y * m_collideNormal.Y; 1394 float p = ctz.X * m_collideNormal.X + ctz.Y * m_collideNormal.Y;
1282 ctz.X *= (float)Math.Sqrt(1 - m_collideNormal.X * m_collideNormal.X); 1395 ctz.X *= (float)Math.Sqrt(1 - m_collideNormal.X * m_collideNormal.X);
1283 ctz.Y *= (float)Math.Sqrt(1 - m_collideNormal.Y * m_collideNormal.Y); 1396 ctz.Y *= (float)Math.Sqrt(1 - m_collideNormal.Y * m_collideNormal.Y);
1284 ctz.Z -= p; 1397 ctz.Z -= p;
1285 if (ctz.Z < 0) 1398 if(ctz.Z < 0)
1286 ctz.Z *= 2; 1399 ctz.Z *= 2;
1287 1400
1288 } 1401 }
1289 1402
1290 } 1403 }
1291 1404
1292 if (!m_freemove) 1405 if(!m_freemove)
1293 { 1406 {
1294 1407
1295 // if velocity is zero, use position control; otherwise, velocity control 1408 // if velocity is zero, use position control; otherwise, velocity control
1296 if (tviszero && m_iscolliding && !m_flying) 1409 if(tviszero && m_iscolliding && !m_flying)
1297 { 1410 {
1298 // keep track of where we stopped. No more slippin' & slidin' 1411 // keep track of where we stopped. No more slippin' & slidin'
1299 if (!_zeroFlag) 1412 if(!_zeroFlag)
1300 { 1413 {
1301 _zeroFlag = true; 1414 _zeroFlag = true;
1302 _zeroPosition = localpos; 1415 _zeroPosition = localpos;
1303 } 1416 }
1304 if (m_pidControllerActive) 1417 if(m_pidControllerActive)
1305 { 1418 {
1306 // We only want to deactivate the PID Controller if we think we want to have our surrogate 1419 // We only want to deactivate the PID Controller if we think we want to have our surrogate
1307 // react to the physics scene by moving it's position. 1420 // react to the physics scene by moving it's position.
@@ -1314,12 +1427,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1314 vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P; 1427 vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P;
1315 else 1428 else
1316 vec.Z += (-vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P) * 0.2f; 1429 vec.Z += (-vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P) * 0.2f;
1317/* 1430 /*
1318 if (flying) 1431 if (flying)
1319 { 1432 {
1320 vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P; 1433 vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P;
1321 } 1434 }
1322*/ 1435 */
1323 } 1436 }
1324 //PidStatus = true; 1437 //PidStatus = true;
1325 } 1438 }
@@ -1328,12 +1441,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1328 m_pidControllerActive = true; 1441 m_pidControllerActive = true;
1329 _zeroFlag = false; 1442 _zeroFlag = false;
1330 1443
1331 if (m_iscolliding) 1444 if(m_iscolliding)
1332 { 1445 {
1333 if (!m_flying) 1446 if(!m_flying)
1334 { 1447 {
1335 // we are on a surface 1448 // we are on a surface
1336 if (ctz.Z > 0f) 1449 if(ctz.Z > 0f)
1337 { 1450 {
1338 // moving up or JUMPING 1451 // moving up or JUMPING
1339 vec.Z += (ctz.Z - vel.Z) * PID_D * 2f; 1452 vec.Z += (ctz.Z - vel.Z) * PID_D * 2f;
@@ -1343,9 +1456,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1343 else 1456 else
1344 { 1457 {
1345 // we are moving down on a surface 1458 // we are moving down on a surface
1346 if (ctz.Z == 0) 1459 if(ctz.Z == 0)
1347 { 1460 {
1348 if (vel.Z > 0) 1461 if(vel.Z > 0)
1349 vec.Z -= vel.Z * PID_D * 2f; 1462 vec.Z -= vel.Z * PID_D * 2f;
1350 vec.X += (ctz.X - vel.X) * (PID_D); 1463 vec.X += (ctz.X - vel.X) * (PID_D);
1351 vec.Y += (ctz.Y - vel.Y) * (PID_D); 1464 vec.Y += (ctz.Y - vel.Y) * (PID_D);
@@ -1353,15 +1466,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1353 // intencionally going down 1466 // intencionally going down
1354 else 1467 else
1355 { 1468 {
1356 if (ctz.Z < vel.Z) 1469 if(ctz.Z < vel.Z)
1357 vec.Z += (ctz.Z - vel.Z) * PID_D; 1470 vec.Z += (ctz.Z - vel.Z) * PID_D;
1358 else 1471 else
1359 { 1472 {
1360 } 1473 }
1361 1474
1362 if (Math.Abs(ctz.X) > Math.Abs(vel.X)) 1475 if(Math.Abs(ctz.X) > Math.Abs(vel.X))
1363 vec.X += (ctz.X - vel.X) * (PID_D); 1476 vec.X += (ctz.X - vel.X) * (PID_D);
1364 if (Math.Abs(ctz.Y) > Math.Abs(vel.Y)) 1477 if(Math.Abs(ctz.Y) > Math.Abs(vel.Y))
1365 vec.Y += (ctz.Y - vel.Y) * (PID_D); 1478 vec.Y += (ctz.Y - vel.Y) * (PID_D);
1366 } 1479 }
1367 } 1480 }
@@ -1378,7 +1491,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1378 } 1491 }
1379 else // ie not colliding 1492 else // ie not colliding
1380 { 1493 {
1381 if (m_flying || hoverPIDActive) //(!m_iscolliding && flying) 1494 if(m_flying || hoverPIDActive) //(!m_iscolliding && flying)
1382 { 1495 {
1383 // we're in mid air suspended 1496 // we're in mid air suspended
1384 vec.X += (ctz.X - vel.X) * (PID_D); 1497 vec.X += (ctz.X - vel.X) * (PID_D);
@@ -1395,13 +1508,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1395 vec.X += (ctz.X - vel.X) * PID_D * 0.833f; 1508 vec.X += (ctz.X - vel.X) * PID_D * 0.833f;
1396 vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f; 1509 vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f;
1397 // hack for breaking on fall 1510 // hack for breaking on fall
1398 if (ctz.Z == -9999f) 1511 if(ctz.Z == -9999f)
1399 vec.Z += -vel.Z * PID_D - m_parent_scene.gravityz * m_mass; 1512 vec.Z += -vel.Z * PID_D - m_parent_scene.gravityz * m_mass;
1400 } 1513 }
1401 } 1514 }
1402 } 1515 }
1403 1516
1404 if (velLengthSquared > 2500.0f) // 50m/s apply breaks 1517 if(velLengthSquared > 2500.0f) // 50m/s apply breaks
1405 { 1518 {
1406 breakfactor = 0.16f * m_mass; 1519 breakfactor = 0.16f * m_mass;
1407 vec.X -= breakfactor * vel.X; 1520 vec.X -= breakfactor * vel.X;
@@ -1414,13 +1527,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1414 breakfactor = m_mass; 1527 breakfactor = m_mass;
1415 vec.X -= breakfactor * vel.X; 1528 vec.X -= breakfactor * vel.X;
1416 vec.Y -= breakfactor * vel.Y; 1529 vec.Y -= breakfactor * vel.Y;
1417 if (m_flying) 1530 if(m_flying)
1418 vec.Z -= 0.5f * breakfactor * vel.Z; 1531 vec.Z -= 0.5f * breakfactor * vel.Z;
1419 else 1532 else
1420 vec.Z -= .16f* m_mass * vel.Z; 1533 vec.Z -= .16f* m_mass * vel.Z;
1421 } 1534 }
1422 1535
1423 if (m_flying || hoverPIDActive) 1536 if(m_flying || hoverPIDActive)
1424 { 1537 {
1425 vec.Z -= m_parent_scene.gravityz * m_mass; 1538 vec.Z -= m_parent_scene.gravityz * m_mass;
1426 1539
@@ -1429,18 +1542,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1429 //Added for auto fly height. Kitto Flora 1542 //Added for auto fly height. Kitto Flora
1430 float target_altitude = terrainheight + MinimumGroundFlightOffset; 1543 float target_altitude = terrainheight + MinimumGroundFlightOffset;
1431 1544
1432 if (localpos.Z < target_altitude) 1545 if(localpos.Z < target_altitude)
1433 { 1546 {
1434 vec.Z += (target_altitude - localpos.Z) * PID_P * 5.0f; 1547 vec.Z += (target_altitude - localpos.Z) * PID_P * 5.0f;
1435 } 1548 }
1436 // end add Kitto Flora 1549 // end add Kitto Flora
1437 } 1550 }
1438 } 1551 }
1439 1552
1440 if (vec.IsFinite()) 1553 if(vec.IsFinite())
1441 { 1554 {
1442 if (vec.X != 0 || vec.Y !=0 || vec.Z !=0) 1555 if(vec.X != 0 || vec.Y !=0 || vec.Z !=0)
1443 d.BodyAddForce(Body, vec.X, vec.Y, vec.Z); 1556 SafeNativeMethods.BodyAddForce(Body,vec.X,vec.Y,vec.Z);
1444 } 1557 }
1445 else 1558 else
1446 { 1559 {
@@ -1457,7 +1570,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1457 // _position = localpos; 1570 // _position = localpos;
1458 _position = localpos; 1571 _position = localpos;
1459 1572
1460 if (_zeroFlag) 1573 if(_zeroFlag)
1461 { 1574 {
1462 _velocity = Vector3.Zero; 1575 _velocity = Vector3.Zero;
1463 _acceleration = Vector3.Zero; 1576 _acceleration = Vector3.Zero;
@@ -1465,12 +1578,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1465 } 1578 }
1466 else 1579 else
1467 { 1580 {
1468 Vector3 a =_velocity; // previus velocity 1581 Vector3 a = _velocity; // previus velocity
1469 SetSmooth(ref _velocity, ref vel, 2); 1582 SetSmooth(ref _velocity,ref vel,2);
1470 a = (_velocity - a) * invtimeStep; 1583 a = (_velocity - a) * invtimeStep;
1471 SetSmooth(ref _acceleration, ref a, 2); 1584 SetSmooth(ref _acceleration,ref a,2);
1472 1585
1473 dtmp = d.BodyGetAngularVel(Body); 1586 dtmp = SafeNativeMethods.BodyGetAngularVel(Body);
1474 m_rotationalVelocity.X = 0f; 1587 m_rotationalVelocity.X = 0f;
1475 m_rotationalVelocity.Y = 0f; 1588 m_rotationalVelocity.Y = 0f;
1476 m_rotationalVelocity.Z = dtmp.Z; 1589 m_rotationalVelocity.Z = dtmp.Z;
@@ -1478,30 +1591,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1478 } 1591 }
1479 } 1592 }
1480 1593
1481 public void round(ref Vector3 v, int digits) 1594 public void round(ref Vector3 v,int digits)
1482 { 1595 {
1483 v.X = (float)Math.Round(v.X, digits); 1596 v.X = (float)Math.Round(v.X,digits);
1484 v.Y = (float)Math.Round(v.Y, digits); 1597 v.Y = (float)Math.Round(v.Y,digits);
1485 v.Z = (float)Math.Round(v.Z, digits); 1598 v.Z = (float)Math.Round(v.Z,digits);
1486 } 1599 }
1487 1600
1488 public void SetSmooth(ref Vector3 dst, ref Vector3 value) 1601 public void SetSmooth(ref Vector3 dst,ref Vector3 value)
1489 { 1602 {
1490 dst.X = 0.1f * dst.X + 0.9f * value.X; 1603 dst.X = 0.1f * dst.X + 0.9f * value.X;
1491 dst.Y = 0.1f * dst.Y + 0.9f * value.Y; 1604 dst.Y = 0.1f * dst.Y + 0.9f * value.Y;
1492 dst.Z = 0.1f * dst.Z + 0.9f * value.Z; 1605 dst.Z = 0.1f * dst.Z + 0.9f * value.Z;
1493 } 1606 }
1494 1607
1495 public void SetSmooth(ref Vector3 dst, ref Vector3 value, int rounddigits) 1608 public void SetSmooth(ref Vector3 dst,ref Vector3 value,int rounddigits)
1496 { 1609 {
1497 dst.X = 0.4f * dst.X + 0.6f * value.X; 1610 dst.X = 0.4f * dst.X + 0.6f * value.X;
1498 dst.X = (float)Math.Round(dst.X, rounddigits); 1611 dst.X = (float)Math.Round(dst.X,rounddigits);
1499 1612
1500 dst.Y = 0.4f * dst.Y + 0.6f * value.Y; 1613 dst.Y = 0.4f * dst.Y + 0.6f * value.Y;
1501 dst.Y = (float)Math.Round(dst.Y, rounddigits); 1614 dst.Y = (float)Math.Round(dst.Y,rounddigits);
1502 1615
1503 dst.Z = 0.4f * dst.Z + 0.6f * value.Z; 1616 dst.Z = 0.4f * dst.Z + 0.6f * value.Z;
1504 dst.Z = (float)Math.Round(dst.Z, rounddigits); 1617 dst.Z = (float)Math.Round(dst.Z,rounddigits);
1505 } 1618 }
1506 1619
1507 1620
@@ -1516,8 +1629,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1516 { 1629 {
1517 return; 1630 return;
1518 1631
1519// if (Body == IntPtr.Zero) 1632 // if (Body == IntPtr.Zero)
1520// return; 1633 // return;
1521 1634
1522 } 1635 }
1523 1636
@@ -1526,16 +1639,38 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1526 /// </summary> 1639 /// </summary>
1527 public void Destroy() 1640 public void Destroy()
1528 { 1641 {
1529 AddChange(changes.Remove, null); 1642 AddChange(changes.Remove,null);
1530 } 1643 }
1531 1644
1532 public override void CrossingFailure() 1645 public override void CrossingFailure()
1533 { 1646 {
1534 } 1647 }
1535 1648
1536 public override Vector3 PIDTarget { set { return; } } 1649 public override Vector3 PIDTarget
1537 public override bool PIDActive {get {return m_pidControllerActive;} set { return; } } 1650 {
1538 public override float PIDTau { set { return; } } 1651 set
1652 {
1653 return;
1654 }
1655 }
1656 public override bool PIDActive
1657 {
1658 get
1659 {
1660 return m_pidControllerActive;
1661 }
1662 set
1663 {
1664 return;
1665 }
1666 }
1667 public override float PIDTau
1668 {
1669 set
1670 {
1671 return;
1672 }
1673 }
1539 1674
1540 public override float PIDHoverHeight 1675 public override float PIDHoverHeight
1541 { 1676 {
@@ -1548,11 +1683,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1548 { 1683 {
1549 get 1684 get
1550 { 1685 {
1551 return m_useHoverPID; 1686 return m_useHoverPID;
1552 } 1687 }
1553 set 1688 set
1554 { 1689 {
1555 AddChange(changes.PIDHoverActive, value); 1690 AddChange(changes.PIDHoverActive,value);
1556 } 1691 }
1557 } 1692 }
1558 1693
@@ -1568,26 +1703,50 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1568 { 1703 {
1569 set 1704 set
1570 { 1705 {
1571 float tmp =0; 1706 float tmp = 0;
1572 if (value > 0) 1707 if(value > 0)
1573 { 1708 {
1574 float mint = (0.05f > timeStep ? 0.05f : timeStep); 1709 float mint = (0.05f > timeStep ? 0.05f : timeStep);
1575 if (value < mint) 1710 if(value < mint)
1576 tmp = mint; 1711 tmp = mint;
1577 else 1712 else
1578 tmp = value; 1713 tmp = value;
1579 } 1714 }
1580 AddChange(changes.PIDHoverTau, tmp); 1715 AddChange(changes.PIDHoverTau,tmp);
1581 } 1716 }
1582 } 1717 }
1583 1718
1584 public override Quaternion APIDTarget { set { return; } } 1719 public override Quaternion APIDTarget
1720 {
1721 set
1722 {
1723 return;
1724 }
1725 }
1585 1726
1586 public override bool APIDActive { set { return; } } 1727 public override bool APIDActive
1728 {
1729 set
1730 {
1731 return;
1732 }
1733 }
1587 1734
1588 public override float APIDStrength { set { return; } } 1735 public override float APIDStrength
1736 {
1737 set
1738 {
1739 return;
1740 }
1741 }
1589 1742
1590 public override float APIDDamping { set { return; } } 1743 public override float APIDDamping
1744 {
1745 set
1746 {
1747 return;
1748 }
1749 }
1591 1750
1592 public override void SubscribeEvents(int ms) 1751 public override void SubscribeEvents(int ms)
1593 { 1752 {
@@ -1605,34 +1764,34 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1605 CollisionEventsThisFrame.Clear(); 1764 CollisionEventsThisFrame.Clear();
1606 } 1765 }
1607 1766
1608 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) 1767 public override void AddCollisionEvent(uint CollidedWith,ContactPoint contact)
1609 { 1768 {
1610 lock(CollisionEventsThisFrame) 1769 lock(CollisionEventsThisFrame)
1611 CollisionEventsThisFrame.AddCollider(CollidedWith, contact); 1770 CollisionEventsThisFrame.AddCollider(CollidedWith,contact);
1612 m_parent_scene.AddCollisionEventReporting(this); 1771 m_parent_scene.AddCollisionEventReporting(this);
1613 } 1772 }
1614 1773
1615 public void SendCollisions(int timestep) 1774 public void SendCollisions(int timestep)
1616 { 1775 {
1617 if (m_cureventsubscription < 50000) 1776 if(m_cureventsubscription < 50000)
1618 m_cureventsubscription += timestep; 1777 m_cureventsubscription += timestep;
1619 1778
1620 if (m_cureventsubscription < m_eventsubscription) 1779 if(m_cureventsubscription < m_eventsubscription)
1621 return; 1780 return;
1622 1781
1623 lock(CollisionEventsThisFrame) 1782 lock(CollisionEventsThisFrame)
1624 { 1783 {
1625 int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; 1784 int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
1626 1785
1627 if (!SentEmptyCollisionsEvent || ncolisions > 0) 1786 if(!SentEmptyCollisionsEvent || ncolisions > 0)
1628 { 1787 {
1629 base.SendCollisionUpdate(CollisionEventsThisFrame); 1788 base.SendCollisionUpdate(CollisionEventsThisFrame);
1630 m_cureventsubscription = 0; 1789 m_cureventsubscription = 0;
1631 1790
1632 if (ncolisions == 0) 1791 if(ncolisions == 0)
1633 { 1792 {
1634 SentEmptyCollisionsEvent = true; 1793 SentEmptyCollisionsEvent = true;
1635 // _parent_scene.RemoveCollisionEventReporting(this); 1794 // _parent_scene.RemoveCollisionEventReporting(this);
1636 } 1795 }
1637 else 1796 else
1638 { 1797 {
@@ -1645,20 +1804,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1645 1804
1646 public override bool SubscribedEvents() 1805 public override bool SubscribedEvents()
1647 { 1806 {
1648 if (m_eventsubscription > 0) 1807 if(m_eventsubscription > 0)
1649 return true; 1808 return true;
1650 return false; 1809 return false;
1651 } 1810 }
1652 1811
1653 private void changePhysicsStatus(bool NewStatus) 1812 private void changePhysicsStatus(bool NewStatus)
1654 { 1813 {
1655 if (NewStatus != m_isPhysical) 1814 if(NewStatus != m_isPhysical)
1656 { 1815 {
1657 if (NewStatus) 1816 if(NewStatus)
1658 { 1817 {
1659 AvatarGeomAndBodyDestroy(); 1818 AvatarGeomAndBodyDestroy();
1660 1819
1661 AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z); 1820 AvatarGeomAndBodyCreation(_position.X,_position.Y,_position.Z);
1662 1821
1663 m_parent_scene.actor_name_map[collider] = (PhysicsActor)this; 1822 m_parent_scene.actor_name_map[collider] = (PhysicsActor)this;
1664 m_parent_scene.actor_name_map[capsule] = (PhysicsActor)this; 1823 m_parent_scene.actor_name_map[capsule] = (PhysicsActor)this;
@@ -1698,20 +1857,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1698 1857
1699 private void changeSize(Vector3 pSize) 1858 private void changeSize(Vector3 pSize)
1700 { 1859 {
1701 if (pSize.IsFinite()) 1860 if(pSize.IsFinite())
1702 { 1861 {
1703 // for now only look to Z changes since viewers also don't change X and Y 1862 // for now only look to Z changes since viewers also don't change X and Y
1704 if (pSize.Z != m_size.Z) 1863 if(pSize.Z != m_size.Z)
1705 { 1864 {
1706 AvatarGeomAndBodyDestroy(); 1865 AvatarGeomAndBodyDestroy();
1707 1866
1708 float oldsz = m_size.Z; 1867 float oldsz = m_size.Z;
1709 m_size = pSize; 1868 m_size = pSize;
1710 1869
1711 AvatarGeomAndBodyCreation(_position.X, _position.Y, 1870 AvatarGeomAndBodyCreation(_position.X,_position.Y,
1712 _position.Z + (m_size.Z - oldsz) * 0.5f); 1871 _position.Z + (m_size.Z - oldsz) * 0.5f);
1713 1872
1714// Velocity = Vector3.Zero; 1873 // Velocity = Vector3.Zero;
1715 m_targetVelocity = Vector3.Zero; 1874 m_targetVelocity = Vector3.Zero;
1716 1875
1717 m_parent_scene.actor_name_map[collider] = (PhysicsActor)this; 1876 m_parent_scene.actor_name_map[collider] = (PhysicsActor)this;
@@ -1726,18 +1885,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1726 } 1885 }
1727 } 1886 }
1728 1887
1729 private void changePosition( Vector3 newPos) 1888 private void changePosition(Vector3 newPos)
1730 { 1889 {
1731 if (Body != IntPtr.Zero) 1890 if(Body != IntPtr.Zero)
1732 d.BodySetPosition(Body, newPos.X, newPos.Y, newPos.Z); 1891 SafeNativeMethods.BodySetPosition(Body,newPos.X,newPos.Y,newPos.Z);
1733 _position = newPos; 1892 _position = newPos;
1734 m_freemove = false; 1893 m_freemove = false;
1735 m_pidControllerActive = true; 1894 m_pidControllerActive = true;
1736 } 1895 }
1737 1896
1738 private void changeOrientation(Quaternion newOri) 1897 private void changeOrientation(Quaternion newOri)
1739 { 1898 {
1740 if (m_orientation != newOri) 1899 if(m_orientation != newOri)
1741 { 1900 {
1742 m_orientation = newOri; // keep a copy for core use 1901 m_orientation = newOri; // keep a copy for core use
1743 // but only use rotations around Z 1902 // but only use rotations around Z
@@ -1746,7 +1905,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1746 m_orientation2D.Z = newOri.Z; 1905 m_orientation2D.Z = newOri.Z;
1747 1906
1748 float t = m_orientation2D.W * m_orientation2D.W + m_orientation2D.Z * m_orientation2D.Z; 1907 float t = m_orientation2D.W * m_orientation2D.W + m_orientation2D.Z * m_orientation2D.Z;
1749 if (t > 0) 1908 if(t > 0)
1750 { 1909 {
1751 t = 1.0f / (float)Math.Sqrt(t); 1910 t = 1.0f / (float)Math.Sqrt(t);
1752 m_orientation2D.W *= t; 1911 m_orientation2D.W *= t;
@@ -1760,12 +1919,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1760 m_orientation2D.Y = 0f; 1919 m_orientation2D.Y = 0f;
1761 m_orientation2D.X = 0f; 1920 m_orientation2D.X = 0f;
1762 1921
1763 d.Quaternion myrot = new d.Quaternion(); 1922 SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
1764 myrot.X = m_orientation2D.X; 1923 myrot.X = m_orientation2D.X;
1765 myrot.Y = m_orientation2D.Y; 1924 myrot.Y = m_orientation2D.Y;
1766 myrot.Z = m_orientation2D.Z; 1925 myrot.Z = m_orientation2D.Z;
1767 myrot.W = m_orientation2D.W; 1926 myrot.W = m_orientation2D.W;
1768 d.BodySetQuaternion(Body, ref myrot); 1927 SafeNativeMethods.BodySetQuaternion(Body,ref myrot);
1769 } 1928 }
1770 } 1929 }
1771 1930
@@ -1774,8 +1933,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1774 _velocity = newVel; 1933 _velocity = newVel;
1775 setFreeMove(); 1934 setFreeMove();
1776 1935
1777 if (Body != IntPtr.Zero) 1936 if(Body != IntPtr.Zero)
1778 d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); 1937 SafeNativeMethods.BodySetLinearVel(Body,newVel.X,newVel.Y,newVel.Z);
1779 } 1938 }
1780 1939
1781 private void changeTargetVelocity(Vector3 newVel) 1940 private void changeTargetVelocity(Vector3 newVel)
@@ -1842,10 +2001,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1842 { 2001 {
1843 setFreeMove(); 2002 setFreeMove();
1844 2003
1845 if (Body != IntPtr.Zero) 2004 if(Body != IntPtr.Zero)
1846 { 2005 {
1847 if (newForce.X != 0f || newForce.Y != 0f || newForce.Z != 0) 2006 if(newForce.X != 0f || newForce.Y != 0f || newForce.Z != 0)
1848 d.BodyAddForce(Body, newForce.X, newForce.Y, newForce.Z); 2007 SafeNativeMethods.BodyAddForce(Body,newForce.X,newForce.Y,newForce.Z);
1849 } 2008 }
1850 } 2009 }
1851 2010
@@ -1855,15 +2014,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1855 _velocity = newmomentum; 2014 _velocity = newmomentum;
1856 setFreeMove(); 2015 setFreeMove();
1857 2016
1858 if (Body != IntPtr.Zero) 2017 if(Body != IntPtr.Zero)
1859 d.BodySetLinearVel(Body, newmomentum.X, newmomentum.Y, newmomentum.Z); 2018 SafeNativeMethods.BodySetLinearVel(Body,newmomentum.X,newmomentum.Y,newmomentum.Z);
1860 } 2019 }
1861 2020
1862 private void changePIDHoverHeight(float val) 2021 private void changePIDHoverHeight(float val)
1863 { 2022 {
1864 m_PIDHoverHeight = val; 2023 m_PIDHoverHeight = val;
1865 if (val == 0) 2024 if(val == 0)
1866 m_useHoverPID = false; 2025 m_useHoverPID = false;
1867 } 2026 }
1868 2027
1869 private void changePIDHoverType(PIDHoverType type) 2028 private void changePIDHoverType(PIDHoverType type)
@@ -1885,15 +2044,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1885 { 2044 {
1886 } 2045 }
1887 2046
1888 public bool DoAChange(changes what, object arg) 2047 public bool DoAChange(changes what,object arg)
1889 { 2048 {
1890 if (collider == IntPtr.Zero && what != changes.Add && what != changes.Remove) 2049 if(collider == IntPtr.Zero && what != changes.Add && what != changes.Remove)
1891 { 2050 {
1892 return false; 2051 return false;
1893 } 2052 }
1894 2053
1895 // nasty switch 2054 // nasty switch
1896 switch (what) 2055 switch(what)
1897 { 2056 {
1898 case changes.Add: 2057 case changes.Add:
1899 changeAdd(); 2058 changeAdd();
@@ -1981,35 +2140,35 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1981 changePIDHoverActive((bool)arg); 2140 changePIDHoverActive((bool)arg);
1982 break; 2141 break;
1983 2142
1984/* not in use for now 2143 /* not in use for now
1985 case changes.Shape: 2144 case changes.Shape:
1986 changeShape((PrimitiveBaseShape)arg); 2145 changeShape((PrimitiveBaseShape)arg);
1987 break; 2146 break;
1988 2147
1989 case changes.CollidesWater: 2148 case changes.CollidesWater:
1990 changeFloatOnWater((bool)arg); 2149 changeFloatOnWater((bool)arg);
1991 break; 2150 break;
1992 2151
1993 case changes.VolumeDtc: 2152 case changes.VolumeDtc:
1994 changeVolumedetetion((bool)arg); 2153 changeVolumedetetion((bool)arg);
1995 break; 2154 break;
1996 2155
1997 case changes.Physical: 2156 case changes.Physical:
1998 changePhysicsStatus((bool)arg); 2157 changePhysicsStatus((bool)arg);
1999 break; 2158 break;
2000 2159
2001 case changes.Selected: 2160 case changes.Selected:
2002 changeSelectedStatus((bool)arg); 2161 changeSelectedStatus((bool)arg);
2003 break; 2162 break;
2004 2163
2005 case changes.disabled: 2164 case changes.disabled:
2006 changeDisable((bool)arg); 2165 changeDisable((bool)arg);
2007 break; 2166 break;
2008 2167
2009 case changes.building: 2168 case changes.building:
2010 changeBuilding((bool)arg); 2169 changeBuilding((bool)arg);
2011 break; 2170 break;
2012*/ 2171 */
2013 case changes.Null: 2172 case changes.Null:
2014 donullchange(); 2173 donullchange();
2015 break; 2174 break;
@@ -2021,9 +2180,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2021 return false; 2180 return false;
2022 } 2181 }
2023 2182
2024 public void AddChange(changes what, object arg) 2183 public void AddChange(changes what,object arg)
2025 { 2184 {
2026 m_parent_scene.AddChange((PhysicsActor)this, what, arg); 2185 m_parent_scene.AddChange((PhysicsActor)this,what,arg);
2027 } 2186 }
2028 2187
2029 private struct strAvatarSize 2188 private struct strAvatarSize
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs
index ce10065..23b1192 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs
@@ -41,13 +41,7 @@
41// Extensive change Ubit 2012 41// Extensive change Ubit 2012
42 42
43using System; 43using System;
44using System.Collections.Generic;
45using System.Reflection;
46using System.Runtime.InteropServices;
47using log4net;
48using OpenMetaverse; 44using OpenMetaverse;
49using OdeAPI;
50using OpenSim.Framework;
51using OpenSim.Region.PhysicsModules.SharedBase; 45using OpenSim.Region.PhysicsModules.SharedBase;
52 46
53namespace OpenSim.Region.PhysicsModule.ubOde 47namespace OpenSim.Region.PhysicsModule.ubOde
@@ -342,9 +336,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
342 m_amEfect = 1.0f ; // turn it on 336 m_amEfect = 1.0f ; // turn it on
343 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale; 337 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
344 338
345 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 339 if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body)
346 && !rootPrim.m_isSelected && !rootPrim.m_disabled) 340 && !rootPrim.m_isSelected && !rootPrim.m_disabled)
347 d.BodyEnable(rootPrim.Body); 341 SafeNativeMethods.BodyEnable(rootPrim.Body);
348 342
349 break; 343 break;
350 case Vehicle.LINEAR_FRICTION_TIMESCALE: 344 case Vehicle.LINEAR_FRICTION_TIMESCALE:
@@ -361,9 +355,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
361 m_lmEfect = 1.0f; // turn it on 355 m_lmEfect = 1.0f; // turn it on
362 356
363 m_ffactor = 0.0f; 357 m_ffactor = 0.0f;
364 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 358 if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body)
365 && !rootPrim.m_isSelected && !rootPrim.m_disabled) 359 && !rootPrim.m_isSelected && !rootPrim.m_disabled)
366 d.BodyEnable(rootPrim.Body); 360 SafeNativeMethods.BodyEnable(rootPrim.Body);
367 break; 361 break;
368 case Vehicle.LINEAR_MOTOR_OFFSET: 362 case Vehicle.LINEAR_MOTOR_OFFSET:
369 m_linearMotorOffset = new Vector3(pValue, pValue, pValue); 363 m_linearMotorOffset = new Vector3(pValue, pValue, pValue);
@@ -399,9 +393,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
399 m_amEfect = 1.0f; // turn it on 393 m_amEfect = 1.0f; // turn it on
400 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale; 394 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
401 395
402 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 396 if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body)
403 && !rootPrim.m_isSelected && !rootPrim.m_disabled) 397 && !rootPrim.m_isSelected && !rootPrim.m_disabled)
404 d.BodyEnable(rootPrim.Body); 398 SafeNativeMethods.BodyEnable(rootPrim.Body);
405 break; 399 break;
406 case Vehicle.LINEAR_FRICTION_TIMESCALE: 400 case Vehicle.LINEAR_FRICTION_TIMESCALE:
407 if (pValue.X < m_timestep) pValue.X = m_timestep; 401 if (pValue.X < m_timestep) pValue.X = m_timestep;
@@ -419,9 +413,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
419 m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale; 413 m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale;
420 414
421 m_ffactor = 0.0f; 415 m_ffactor = 0.0f;
422 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 416 if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body)
423 && !rootPrim.m_isSelected && !rootPrim.m_disabled) 417 && !rootPrim.m_isSelected && !rootPrim.m_disabled)
424 d.BodyEnable(rootPrim.Body); 418 SafeNativeMethods.BodyEnable(rootPrim.Body);
425 break; 419 break;
426 case Vehicle.LINEAR_MOTOR_OFFSET: 420 case Vehicle.LINEAR_MOTOR_OFFSET:
427 m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z); 421 m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z);
@@ -772,30 +766,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde
772 { 766 {
773 IntPtr Body = rootPrim.Body; 767 IntPtr Body = rootPrim.Body;
774 768
775 d.Mass dmass; 769 SafeNativeMethods.Mass dmass;
776 d.BodyGetMass(Body, out dmass); 770 SafeNativeMethods.BodyGetMass(Body, out dmass);
777 771
778 d.Quaternion rot = d.BodyGetQuaternion(Body); 772 SafeNativeMethods.Quaternion rot = SafeNativeMethods.BodyGetQuaternion(Body);
779 Quaternion objrotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object 773 Quaternion objrotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object
780 Quaternion rotq = objrotq; // rotq = rotation of object 774 Quaternion rotq = objrotq; // rotq = rotation of object
781 rotq *= m_referenceFrame; // rotq is now rotation in vehicle reference frame 775 rotq *= m_referenceFrame; // rotq is now rotation in vehicle reference frame
782 Quaternion irotq = Quaternion.Inverse(rotq); 776 Quaternion irotq = Quaternion.Inverse(rotq);
783 777
784 d.Vector3 dvtmp; 778 SafeNativeMethods.Vector3 dvtmp;
785 Vector3 tmpV; 779 Vector3 tmpV;
786 Vector3 curVel; // velocity in world 780 Vector3 curVel; // velocity in world
787 Vector3 curAngVel; // angular velocity in world 781 Vector3 curAngVel; // angular velocity in world
788 Vector3 force = Vector3.Zero; // actually linear aceleration until mult by mass in world frame 782 Vector3 force = Vector3.Zero; // actually linear aceleration until mult by mass in world frame
789 Vector3 torque = Vector3.Zero;// actually angular aceleration until mult by Inertia in vehicle frame 783 Vector3 torque = Vector3.Zero;// actually angular aceleration until mult by Inertia in vehicle frame
790 d.Vector3 dtorque = new d.Vector3(); 784 SafeNativeMethods.Vector3 dtorque = new SafeNativeMethods.Vector3();
791 785
792 dvtmp = d.BodyGetLinearVel(Body); 786 dvtmp = SafeNativeMethods.BodyGetLinearVel(Body);
793 curVel.X = dvtmp.X; 787 curVel.X = dvtmp.X;
794 curVel.Y = dvtmp.Y; 788 curVel.Y = dvtmp.Y;
795 curVel.Z = dvtmp.Z; 789 curVel.Z = dvtmp.Z;
796 Vector3 curLocalVel = curVel * irotq; // current velocity in local 790 Vector3 curLocalVel = curVel * irotq; // current velocity in local
797 791
798 dvtmp = d.BodyGetAngularVel(Body); 792 dvtmp = SafeNativeMethods.BodyGetAngularVel(Body);
799 curAngVel.X = dvtmp.X; 793 curAngVel.X = dvtmp.X;
800 curAngVel.Y = dvtmp.Y; 794 curAngVel.Y = dvtmp.Y;
801 curAngVel.Z = dvtmp.Z; 795 curAngVel.Z = dvtmp.Z;
@@ -839,7 +833,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
839 { 833 {
840 // have offset, do it now 834 // have offset, do it now
841 tmpV *= dmass.mass; 835 tmpV *= dmass.mass;
842 d.BodyAddForceAtRelPos(Body, tmpV.X, tmpV.Y, tmpV.Z, m_linearMotorOffset.X, m_linearMotorOffset.Y, m_linearMotorOffset.Z); 836 SafeNativeMethods.BodyAddForceAtRelPos(Body, tmpV.X, tmpV.Y, tmpV.Z, m_linearMotorOffset.X, m_linearMotorOffset.Y, m_linearMotorOffset.Z);
843 } 837 }
844 else 838 else
845 { 839 {
@@ -862,7 +856,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
862 if (m_VhoverTimescale < 300 && rootPrim.prim_geom != IntPtr.Zero) 856 if (m_VhoverTimescale < 300 && rootPrim.prim_geom != IntPtr.Zero)
863 { 857 {
864 // d.Vector3 pos = d.BodyGetPosition(Body); 858 // d.Vector3 pos = d.BodyGetPosition(Body);
865 d.Vector3 pos = d.GeomGetPosition(rootPrim.prim_geom); 859 SafeNativeMethods.Vector3 pos = SafeNativeMethods.GeomGetPosition(rootPrim.prim_geom);
866 pos.Z -= 0.21f; // minor offset that seems to be always there in sl 860 pos.Z -= 0.21f; // minor offset that seems to be always there in sl
867 861
868 float t = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y); 862 float t = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y);
@@ -1181,7 +1175,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1181 1175
1182 if (force.X != 0 || force.Y != 0 || force.Z != 0) 1176 if (force.X != 0 || force.Y != 0 || force.Z != 0)
1183 { 1177 {
1184 d.BodyAddForce(Body, force.X, force.Y, force.Z); 1178 SafeNativeMethods.BodyAddForce(Body, force.X, force.Y, force.Z);
1185 } 1179 }
1186 1180
1187 if (torque.X != 0 || torque.Y != 0 || torque.Z != 0) 1181 if (torque.X != 0 || torque.Y != 0 || torque.Z != 0)
@@ -1191,15 +1185,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1191 dtorque.Y = torque.Y; 1185 dtorque.Y = torque.Y;
1192 dtorque.Z = torque.Z; 1186 dtorque.Z = torque.Z;
1193 1187
1194 d.MultiplyM3V3(out dvtmp, ref dmass.I, ref dtorque); 1188 SafeNativeMethods.MultiplyM3V3(out dvtmp, ref dmass.I, ref dtorque);
1195 d.BodyAddRelTorque(Body, dvtmp.X, dvtmp.Y, dvtmp.Z); // add torque in object frame 1189 SafeNativeMethods.BodyAddRelTorque(Body, dvtmp.X, dvtmp.Y, dvtmp.Z); // add torque in object frame
1196 } 1190 }
1197 1191
1198 torque = rootPrim.m_torque; 1192 torque = rootPrim.m_torque;
1199 torque += rootPrim.m_angularForceacc; 1193 torque += rootPrim.m_angularForceacc;
1200 rootPrim.m_angularForceacc = Vector3.Zero; 1194 rootPrim.m_angularForceacc = Vector3.Zero;
1201 if (torque.X != 0 || torque.Y != 0 || torque.Z != 0) 1195 if (torque.X != 0 || torque.Y != 0 || torque.Z != 0)
1202 d.BodyAddTorque(Body,torque.X, torque.Y, torque.Z); 1196 SafeNativeMethods.BodyAddTorque(Body,torque.X, torque.Y, torque.Z);
1203 } 1197 }
1204 } 1198 }
1205} 1199}
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs
index 5465035..bdfbe3d 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs
@@ -3,15 +3,10 @@
3 */ 3 */
4 4
5using System; 5using System;
6using System.Collections.Concurrent;
6using System.Threading; 7using System.Threading;
7using System.Collections.Generic;
8using System.IO;
9using System.Reflection;
10using System.Runtime.InteropServices;
11using System.Text;
12using OpenSim.Framework; 8using OpenSim.Framework;
13using OpenSim.Region.PhysicsModules.SharedBase; 9using OpenSim.Region.PhysicsModules.SharedBase;
14using OdeAPI;
15using log4net; 10using log4net;
16using Nini.Config; 11using Nini.Config;
17using OpenMetaverse; 12using OpenMetaverse;
@@ -79,7 +74,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
79 public float MeshSculptphysicalLOD = 32; 74 public float MeshSculptphysicalLOD = 32;
80 public float MinSizeToMeshmerize = 0.1f; 75 public float MinSizeToMeshmerize = 0.1f;
81 76
82 private OpenSim.Framework.BlockingQueue<ODEPhysRepData> workQueue = new OpenSim.Framework.BlockingQueue<ODEPhysRepData>(); 77 private BlockingCollection<ODEPhysRepData> workQueue = new BlockingCollection<ODEPhysRepData>();
83 private bool m_running; 78 private bool m_running;
84 79
85 private Thread m_thread; 80 private Thread m_thread;
@@ -106,10 +101,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
106 private void DoWork() 101 private void DoWork()
107 { 102 {
108 m_mesher.ExpireFileCache(); 103 m_mesher.ExpireFileCache();
104 ODEPhysRepData nextRep;
109 105
110 while(m_running) 106 while(m_running)
111 { 107 {
112 ODEPhysRepData nextRep = workQueue.Dequeue(); 108 workQueue.TryTake(out nextRep, -1);
113 if(!m_running) 109 if(!m_running)
114 return; 110 return;
115 if (nextRep == null) 111 if (nextRep == null)
@@ -138,7 +134,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
138 try 134 try
139 { 135 {
140 m_thread.Abort(); 136 m_thread.Abort();
141 workQueue.Clear(); 137 // workQueue.Dispose();
142 } 138 }
143 catch 139 catch
144 { 140 {
@@ -195,7 +191,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
195 repData.meshState = MeshState.loadingAsset; 191 repData.meshState = MeshState.loadingAsset;
196 192
197 repData.comand = meshWorkerCmnds.getmesh; 193 repData.comand = meshWorkerCmnds.getmesh;
198 workQueue.Enqueue(repData); 194 workQueue.Add(repData);
199 } 195 }
200 } 196 }
201 197
@@ -241,7 +237,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
241 if (needsMeshing(repData)) // no need for pbs now? 237 if (needsMeshing(repData)) // no need for pbs now?
242 { 238 {
243 repData.comand = meshWorkerCmnds.changefull; 239 repData.comand = meshWorkerCmnds.changefull;
244 workQueue.Enqueue(repData); 240 workQueue.Add(repData);
245 } 241 }
246 } 242 }
247 else 243 else
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs
index 4cb1736..90560fd 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs
@@ -4,7 +4,6 @@ using System.Reflection;
4using log4net; 4using log4net;
5using Nini.Config; 5using Nini.Config;
6using Mono.Addins; 6using Mono.Addins;
7using OdeAPI;
8using OpenSim.Framework; 7using OpenSim.Framework;
9using OpenSim.Region.Framework.Scenes; 8using OpenSim.Region.Framework.Scenes;
10using OpenSim.Region.Framework.Interfaces; 9using OpenSim.Region.Framework.Interfaces;
@@ -53,9 +52,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
53 if (Util.IsWindows()) 52 if (Util.IsWindows())
54 Util.LoadArchSpecificWindowsDll("ode.dll"); 53 Util.LoadArchSpecificWindowsDll("ode.dll");
55 54
56 d.InitODE(); 55 SafeNativeMethods.InitODE();
57 56
58 string ode_config = d.GetConfiguration(); 57 string ode_config = SafeNativeMethods.GetConfiguration();
59 if (ode_config != null && ode_config != "") 58 if (ode_config != null && ode_config != "")
60 { 59 {
61 m_log.InfoFormat("[ubODE] ode library configuration: {0}", ode_config); 60 m_log.InfoFormat("[ubODE] ode library configuration: {0}", ode_config);
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index aa208e2..4e18522 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -44,11 +44,8 @@
44using System; 44using System;
45using System.Collections.Generic; 45using System.Collections.Generic;
46using System.Reflection; 46using System.Reflection;
47using System.Runtime.InteropServices;
48using System.Threading;
49using log4net; 47using log4net;
50using OpenMetaverse; 48using OpenMetaverse;
51using OdeAPI;
52using OpenSim.Framework; 49using OpenSim.Framework;
53using OpenSim.Region.PhysicsModules.SharedBase; 50using OpenSim.Region.PhysicsModules.SharedBase;
54 51
@@ -182,7 +179,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
182 private float m_physCost; 179 private float m_physCost;
183 private float m_streamCost; 180 private float m_streamCost;
184 181
185 public d.Mass primdMass; // prim inertia information on it's own referencial 182 internal SafeNativeMethods.Mass primdMass; // prim inertia information on it's own referencial
186 private PhysicsInertiaData m_InertiaOverride; 183 private PhysicsInertiaData m_InertiaOverride;
187 float primMass; // prim own mass 184 float primMass; // prim own mass
188 float primVolume; // prim own volume; 185 float primVolume; // prim own volume;
@@ -196,8 +193,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
196 193
197 private int m_eventsubscription; 194 private int m_eventsubscription;
198 private int m_cureventsubscription; 195 private int m_cureventsubscription;
199 private CollisionEventUpdate CollisionEventsThisFrame = null; 196 private CollisionEventUpdate CollisionEvents = null;
200 private CollisionEventUpdate CollisionVDTCEventsThisFrame = null; 197 private CollisionEventUpdate CollisionVDTCEvents = null;
201 private bool SentEmptyCollisionsEvent; 198 private bool SentEmptyCollisionsEvent;
202 199
203 public volatile bool childPrim; 200 public volatile bool childPrim;
@@ -489,7 +486,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
489 // double buffering 486 // double buffering
490 if(m_fakeInertiaOverride != null) 487 if(m_fakeInertiaOverride != null)
491 { 488 {
492 d.Mass objdmass = new d.Mass(); 489 SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass();
493 objdmass.I.M00 = m_fakeInertiaOverride.Inertia.X; 490 objdmass.I.M00 = m_fakeInertiaOverride.Inertia.X;
494 objdmass.I.M11 = m_fakeInertiaOverride.Inertia.Y; 491 objdmass.I.M11 = m_fakeInertiaOverride.Inertia.Y;
495 objdmass.I.M22 = m_fakeInertiaOverride.Inertia.Z; 492 objdmass.I.M22 = m_fakeInertiaOverride.Inertia.Z;
@@ -498,15 +495,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
498 495
499 if(Math.Abs(m_fakeInertiaOverride.InertiaRotation.W) < 0.999) 496 if(Math.Abs(m_fakeInertiaOverride.InertiaRotation.W) < 0.999)
500 { 497 {
501 d.Matrix3 inertiarotmat = new d.Matrix3(); 498 SafeNativeMethods.Matrix3 inertiarotmat = new SafeNativeMethods.Matrix3();
502 d.Quaternion inertiarot = new d.Quaternion(); 499 SafeNativeMethods.Quaternion inertiarot = new SafeNativeMethods.Quaternion();
503 500
504 inertiarot.X = m_fakeInertiaOverride.InertiaRotation.X; 501 inertiarot.X = m_fakeInertiaOverride.InertiaRotation.X;
505 inertiarot.Y = m_fakeInertiaOverride.InertiaRotation.Y; 502 inertiarot.Y = m_fakeInertiaOverride.InertiaRotation.Y;
506 inertiarot.Z = m_fakeInertiaOverride.InertiaRotation.Z; 503 inertiarot.Z = m_fakeInertiaOverride.InertiaRotation.Z;
507 inertiarot.W = m_fakeInertiaOverride.InertiaRotation.W; 504 inertiarot.W = m_fakeInertiaOverride.InertiaRotation.W;
508 d.RfromQ(out inertiarotmat, ref inertiarot); 505 SafeNativeMethods.RfromQ(out inertiarotmat, ref inertiarot);
509 d.MassRotate(ref objdmass, ref inertiarotmat); 506 SafeNativeMethods.MassRotate(ref objdmass, ref inertiarotmat);
510 } 507 }
511 508
512 inertia.TotalMass = m_fakeInertiaOverride.TotalMass; 509 inertia.TotalMass = m_fakeInertiaOverride.TotalMass;
@@ -530,13 +527,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
530 return inertia; 527 return inertia;
531 } 528 }
532 529
533 d.Vector3 dtmp; 530 SafeNativeMethods.Vector3 dtmp;
534 d.Mass m = new d.Mass(); 531 SafeNativeMethods.Mass m = new SafeNativeMethods.Mass();
535 lock(_parent_scene.OdeLock) 532 lock(_parent_scene.OdeLock)
536 { 533 {
537 d.AllocateODEDataForThread(0); 534 SafeNativeMethods.AllocateODEDataForThread(0);
538 dtmp = d.GeomGetOffsetPosition(prim_geom); 535 dtmp = SafeNativeMethods.GeomGetOffsetPosition(prim_geom);
539 d.BodyGetMass(Body, out m); 536 SafeNativeMethods.BodyGetMass(Body, out m);
540 } 537 }
541 538
542 Vector3 cm = new Vector3(-dtmp.X, -dtmp.Y, -dtmp.Z); 539 Vector3 cm = new Vector3(-dtmp.X, -dtmp.Y, -dtmp.Z);
@@ -572,18 +569,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
572 { 569 {
573 lock (_parent_scene.OdeLock) 570 lock (_parent_scene.OdeLock)
574 { 571 {
575 d.AllocateODEDataForThread(0); 572 SafeNativeMethods.AllocateODEDataForThread(0);
576 573
577 d.Vector3 dtmp; 574 SafeNativeMethods.Vector3 dtmp;
578 if (!childPrim && Body != IntPtr.Zero) 575 if (!childPrim && Body != IntPtr.Zero)
579 { 576 {
580 dtmp = d.BodyGetPosition(Body); 577 dtmp = SafeNativeMethods.BodyGetPosition(Body);
581 return new Vector3(dtmp.X, dtmp.Y, dtmp.Z); 578 return new Vector3(dtmp.X, dtmp.Y, dtmp.Z);
582 } 579 }
583 else if (prim_geom != IntPtr.Zero) 580 else if (prim_geom != IntPtr.Zero)
584 { 581 {
585 d.Quaternion dq; 582 SafeNativeMethods.Quaternion dq;
586 d.GeomCopyQuaternion(prim_geom, out dq); 583 SafeNativeMethods.GeomCopyQuaternion(prim_geom, out dq);
587 Quaternion q; 584 Quaternion q;
588 q.X = dq.X; 585 q.X = dq.X;
589 q.Y = dq.Y; 586 q.Y = dq.Y;
@@ -591,7 +588,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
591 q.W = dq.W; 588 q.W = dq.W;
592 589
593 Vector3 Ptot = m_OBBOffset * q; 590 Vector3 Ptot = m_OBBOffset * q;
594 dtmp = d.GeomGetPosition(prim_geom); 591 dtmp = SafeNativeMethods.GeomGetPosition(prim_geom);
595 Ptot.X += dtmp.X; 592 Ptot.X += dtmp.X;
596 Ptot.Y += dtmp.Y; 593 Ptot.Y += dtmp.Y;
597 Ptot.Z += dtmp.Z; 594 Ptot.Z += dtmp.Z;
@@ -997,16 +994,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
997 _velocity.Y = 0; 994 _velocity.Y = 0;
998 _velocity.Z = 0; 995 _velocity.Z = 0;
999 996
1000 d.AllocateODEDataForThread(0); 997 SafeNativeMethods.AllocateODEDataForThread(0);
1001 998
1002 m_lastVelocity = _velocity; 999 m_lastVelocity = _velocity;
1003 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) 1000 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
1004 m_vehicle.Stop(); 1001 m_vehicle.Stop();
1005 1002
1006 if(Body != IntPtr.Zero) 1003 if(Body != IntPtr.Zero)
1007 d.BodySetLinearVel(Body, 0, 0, 0); // stop it 1004 SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it
1008 if (prim_geom != IntPtr.Zero) 1005 if (prim_geom != IntPtr.Zero)
1009 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 1006 SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
1010 1007
1011 m_outbounds = false; 1008 m_outbounds = false;
1012 changeDisable(false); 1009 changeDisable(false);
@@ -1027,24 +1024,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1027 m_lastposition = _position; 1024 m_lastposition = _position;
1028 m_lastorientation = _orientation; 1025 m_lastorientation = _orientation;
1029 1026
1030 d.AllocateODEDataForThread(0); 1027 SafeNativeMethods.AllocateODEDataForThread(0);
1031 if(Body != IntPtr.Zero) 1028 if(Body != IntPtr.Zero)
1032 { 1029 {
1033 d.Vector3 dtmp = d.BodyGetAngularVel(Body); 1030 SafeNativeMethods.Vector3 dtmp = SafeNativeMethods.BodyGetAngularVel(Body);
1034 m_rotationalVelocity.X = dtmp.X; 1031 m_rotationalVelocity.X = dtmp.X;
1035 m_rotationalVelocity.Y = dtmp.Y; 1032 m_rotationalVelocity.Y = dtmp.Y;
1036 m_rotationalVelocity.Z = dtmp.Z; 1033 m_rotationalVelocity.Z = dtmp.Z;
1037 1034
1038 dtmp = d.BodyGetLinearVel(Body); 1035 dtmp = SafeNativeMethods.BodyGetLinearVel(Body);
1039 _velocity.X = dtmp.X; 1036 _velocity.X = dtmp.X;
1040 _velocity.Y = dtmp.Y; 1037 _velocity.Y = dtmp.Y;
1041 _velocity.Z = dtmp.Z; 1038 _velocity.Z = dtmp.Z;
1042 1039
1043 d.BodySetLinearVel(Body, 0, 0, 0); // stop it 1040 SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it
1044 d.BodySetAngularVel(Body, 0, 0, 0); 1041 SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0);
1045 } 1042 }
1046 if(prim_geom != IntPtr.Zero) 1043 if(prim_geom != IntPtr.Zero)
1047 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 1044 SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
1048 disableBodySoft(); // stop collisions 1045 disableBodySoft(); // stop collisions
1049 UnSubscribeEvents(); 1046 UnSubscribeEvents();
1050 } 1047 }
@@ -1138,24 +1135,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1138 { 1135 {
1139 m_eventsubscription = ms; 1136 m_eventsubscription = ms;
1140 m_cureventsubscription = 0; 1137 m_cureventsubscription = 0;
1141 if (CollisionEventsThisFrame == null) 1138 if (CollisionEvents == null)
1142 CollisionEventsThisFrame = new CollisionEventUpdate(); 1139 CollisionEvents = new CollisionEventUpdate();
1143 if (CollisionVDTCEventsThisFrame == null) 1140 if (CollisionVDTCEvents == null)
1144 CollisionVDTCEventsThisFrame = new CollisionEventUpdate(); 1141 CollisionVDTCEvents = new CollisionEventUpdate();
1145 SentEmptyCollisionsEvent = false; 1142 SentEmptyCollisionsEvent = false;
1146 } 1143 }
1147 1144
1148 public override void UnSubscribeEvents() 1145 public override void UnSubscribeEvents()
1149 { 1146 {
1150 if (CollisionVDTCEventsThisFrame != null) 1147 if (CollisionVDTCEvents != null)
1151 { 1148 {
1152 CollisionVDTCEventsThisFrame.Clear(); 1149 CollisionVDTCEvents.Clear();
1153 CollisionVDTCEventsThisFrame = null; 1150 CollisionVDTCEvents = null;
1154 } 1151 }
1155 if (CollisionEventsThisFrame != null) 1152 if (CollisionEvents != null)
1156 { 1153 {
1157 CollisionEventsThisFrame.Clear(); 1154 CollisionEvents.Clear();
1158 CollisionEventsThisFrame = null; 1155 CollisionEvents = null;
1159 } 1156 }
1160 m_eventsubscription = 0; 1157 m_eventsubscription = 0;
1161 _parent_scene.RemoveCollisionEventReporting(this); 1158 _parent_scene.RemoveCollisionEventReporting(this);
@@ -1163,27 +1160,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1163 1160
1164 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) 1161 public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact)
1165 { 1162 {
1166 if (CollisionEventsThisFrame == null) 1163 if (CollisionEvents == null)
1167 CollisionEventsThisFrame = new CollisionEventUpdate(); 1164 CollisionEvents = new CollisionEventUpdate();
1168 1165
1169 CollisionEventsThisFrame.AddCollider(CollidedWith, contact); 1166 CollisionEvents.AddCollider(CollidedWith, contact);
1170 _parent_scene.AddCollisionEventReporting(this); 1167 _parent_scene.AddCollisionEventReporting(this);
1171 } 1168 }
1172 1169
1173 public override void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact) 1170 public override void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact)
1174 { 1171 {
1175 if (CollisionVDTCEventsThisFrame == null) 1172 if (CollisionVDTCEvents == null)
1176 CollisionVDTCEventsThisFrame = new CollisionEventUpdate(); 1173 CollisionVDTCEvents = new CollisionEventUpdate();
1177 1174
1178 CollisionVDTCEventsThisFrame.AddCollider(CollidedWith, contact); 1175 CollisionVDTCEvents.AddCollider(CollidedWith, contact);
1179 _parent_scene.AddCollisionEventReporting(this); 1176 _parent_scene.AddCollisionEventReporting(this);
1180 } 1177 }
1181 1178
1182 internal void SleeperAddCollisionEvents() 1179 internal void SleeperAddCollisionEvents()
1183 { 1180 {
1184 if(CollisionEventsThisFrame != null && CollisionEventsThisFrame.m_objCollisionList.Count != 0) 1181 if(CollisionEvents != null && CollisionEvents.m_objCollisionList.Count != 0)
1185 { 1182 {
1186 foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionEventsThisFrame.m_objCollisionList) 1183 foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionEvents.m_objCollisionList)
1187 { 1184 {
1188 if(kvp.Key == 0) 1185 if(kvp.Key == 0)
1189 continue; 1186 continue;
@@ -1196,9 +1193,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1196 other.AddCollisionEvent(ParentActor.LocalID,cp); 1193 other.AddCollisionEvent(ParentActor.LocalID,cp);
1197 } 1194 }
1198 } 1195 }
1199 if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.m_objCollisionList.Count != 0) 1196 if(CollisionVDTCEvents != null && CollisionVDTCEvents.m_objCollisionList.Count != 0)
1200 { 1197 {
1201 foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionVDTCEventsThisFrame.m_objCollisionList) 1198 foreach(KeyValuePair<uint,ContactPoint> kvp in CollisionVDTCEvents.m_objCollisionList)
1202 { 1199 {
1203 OdePrim other = _parent_scene.getPrim(kvp.Key); 1200 OdePrim other = _parent_scene.getPrim(kvp.Key);
1204 if(other == null) 1201 if(other == null)
@@ -1213,8 +1210,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1213 1210
1214 internal void clearSleeperCollisions() 1211 internal void clearSleeperCollisions()
1215 { 1212 {
1216 if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.Count >0 ) 1213 if(CollisionVDTCEvents != null && CollisionVDTCEvents.Count >0 )
1217 CollisionVDTCEventsThisFrame.Clear(); 1214 CollisionVDTCEvents.Clear();
1218 } 1215 }
1219 1216
1220 public void SendCollisions(int timestep) 1217 public void SendCollisions(int timestep)
@@ -1226,14 +1223,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1226 if (m_cureventsubscription < m_eventsubscription) 1223 if (m_cureventsubscription < m_eventsubscription)
1227 return; 1224 return;
1228 1225
1229 if (CollisionEventsThisFrame == null) 1226 if (CollisionEvents == null)
1230 return; 1227 return;
1231 1228
1232 int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; 1229 int ncolisions = CollisionEvents.m_objCollisionList.Count;
1233 1230
1234 if (!SentEmptyCollisionsEvent || ncolisions > 0) 1231 if (!SentEmptyCollisionsEvent || ncolisions > 0)
1235 { 1232 {
1236 base.SendCollisionUpdate(CollisionEventsThisFrame); 1233 base.SendCollisionUpdate(CollisionEvents);
1237 m_cureventsubscription = 0; 1234 m_cureventsubscription = 0;
1238 1235
1239 if (ncolisions == 0) 1236 if (ncolisions == 0)
@@ -1241,10 +1238,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1241 SentEmptyCollisionsEvent = true; 1238 SentEmptyCollisionsEvent = true;
1242// _parent_scene.RemoveCollisionEventReporting(this); 1239// _parent_scene.RemoveCollisionEventReporting(this);
1243 } 1240 }
1244 else if(Body == IntPtr.Zero || (d.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 )) 1241 else if(Body == IntPtr.Zero || (SafeNativeMethods.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 ))
1245 { 1242 {
1246 SentEmptyCollisionsEvent = false; 1243 SentEmptyCollisionsEvent = false;
1247 CollisionEventsThisFrame.Clear(); 1244 CollisionEvents.Clear();
1248 } 1245 }
1249 } 1246 }
1250 } 1247 }
@@ -1450,16 +1447,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1450 { 1447 {
1451 if (prm.m_NoColide) 1448 if (prm.m_NoColide)
1452 { 1449 {
1453 d.GeomSetCategoryBits(prm.prim_geom, 0); 1450 SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, 0);
1454 if (m_isphysical) 1451 if (m_isphysical)
1455 d.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land); 1452 SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land);
1456 else 1453 else
1457 d.GeomSetCollideBits(prm.prim_geom, 0); 1454 SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, 0);
1458 } 1455 }
1459 else 1456 else
1460 { 1457 {
1461 d.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories); 1458 SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories);
1462 d.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags); 1459 SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags);
1463 } 1460 }
1464 } 1461 }
1465 } 1462 }
@@ -1467,22 +1464,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1467 1464
1468 if (m_NoColide) 1465 if (m_NoColide)
1469 { 1466 {
1470 d.GeomSetCategoryBits(prim_geom, 0); 1467 SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
1471 d.GeomSetCollideBits(prim_geom, (uint)CollisionCategories.Land); 1468 SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)CollisionCategories.Land);
1472 if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) 1469 if (collide_geom != prim_geom && collide_geom != IntPtr.Zero)
1473 { 1470 {
1474 d.GeomSetCategoryBits(collide_geom, 0); 1471 SafeNativeMethods.GeomSetCategoryBits(collide_geom, 0);
1475 d.GeomSetCollideBits(collide_geom, (uint)CollisionCategories.Land); 1472 SafeNativeMethods.GeomSetCollideBits(collide_geom, (uint)CollisionCategories.Land);
1476 } 1473 }
1477 } 1474 }
1478 else 1475 else
1479 { 1476 {
1480 d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); 1477 SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
1481 d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); 1478 SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
1482 if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) 1479 if (collide_geom != prim_geom && collide_geom != IntPtr.Zero)
1483 { 1480 {
1484 d.GeomSetCategoryBits(collide_geom, (uint)m_collisionCategories); 1481 SafeNativeMethods.GeomSetCategoryBits(collide_geom, (uint)m_collisionCategories);
1485 d.GeomSetCollideBits(collide_geom, (uint)m_collisionFlags); 1482 SafeNativeMethods.GeomSetCollideBits(collide_geom, (uint)m_collisionFlags);
1486 } 1483 }
1487 } 1484 }
1488 } 1485 }
@@ -1495,7 +1492,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1495 1492
1496 if (Amotor != IntPtr.Zero) 1493 if (Amotor != IntPtr.Zero)
1497 { 1494 {
1498 d.JointDestroy(Amotor); 1495 SafeNativeMethods.JointDestroy(Amotor);
1499 Amotor = IntPtr.Zero; 1496 Amotor = IntPtr.Zero;
1500 } 1497 }
1501 1498
@@ -1522,19 +1519,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1522 if(axisnum == 0) 1519 if(axisnum == 0)
1523 return; 1520 return;
1524 // stop it 1521 // stop it
1525 d.BodySetTorque(Body, 0, 0, 0); 1522 SafeNativeMethods.BodySetTorque(Body, 0, 0, 0);
1526 d.BodySetAngularVel(Body, 0, 0, 0); 1523 SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0);
1527 1524
1528 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); 1525 Amotor = SafeNativeMethods.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
1529 d.JointAttach(Amotor, Body, IntPtr.Zero); 1526 SafeNativeMethods.JointAttach(Amotor, Body, IntPtr.Zero);
1530 1527
1531 d.JointSetAMotorMode(Amotor, 0); 1528 SafeNativeMethods.JointSetAMotorMode(Amotor, 0);
1532 1529
1533 d.JointSetAMotorNumAxes(Amotor, axisnum); 1530 SafeNativeMethods.JointSetAMotorNumAxes(Amotor, axisnum);
1534 1531
1535 // get current orientation to lock 1532 // get current orientation to lock
1536 1533
1537 d.Quaternion dcur = d.BodyGetQuaternion(Body); 1534 SafeNativeMethods.Quaternion dcur = SafeNativeMethods.BodyGetQuaternion(Body);
1538 Quaternion curr; // crap convertion between identical things 1535 Quaternion curr; // crap convertion between identical things
1539 curr.X = dcur.X; 1536 curr.X = dcur.X;
1540 curr.Y = dcur.Y; 1537 curr.Y = dcur.Y;
@@ -1547,17 +1544,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1547 if (axisX) 1544 if (axisX)
1548 { 1545 {
1549 ax = (new Vector3(1, 0, 0)) * curr; // rotate world X to current local X 1546 ax = (new Vector3(1, 0, 0)) * curr; // rotate world X to current local X
1550 d.JointSetAMotorAxis(Amotor, 0, 0, ax.X, ax.Y, ax.Z); 1547 SafeNativeMethods.JointSetAMotorAxis(Amotor, 0, 0, ax.X, ax.Y, ax.Z);
1551 d.JointSetAMotorAngle(Amotor, 0, 0); 1548 SafeNativeMethods.JointSetAMotorAngle(Amotor, 0, 0);
1552 d.JointSetAMotorParam(Amotor, (int)d.JointParam.LoStop, 0f); 1549 SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.LoStop, 0f);
1553 d.JointSetAMotorParam(Amotor, (int)d.JointParam.HiStop, 0f); 1550 SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.HiStop, 0f);
1554 d.JointSetAMotorParam(Amotor, (int)d.JointParam.Vel, 0); 1551 SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Vel, 0);
1555 d.JointSetAMotorParam(Amotor, (int)d.JointParam.FudgeFactor, 0.0001f); 1552 SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.FudgeFactor, 0.0001f);
1556 d.JointSetAMotorParam(Amotor, (int)d.JointParam.Bounce, 0f); 1553 SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Bounce, 0f);
1557 d.JointSetAMotorParam(Amotor, (int)d.JointParam.CFM, 0f); 1554 SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.CFM, 0f);
1558 d.JointSetAMotorParam(Amotor, (int)d.JointParam.FMax, 5e8f); 1555 SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.FMax, 5e8f);
1559 d.JointSetAMotorParam(Amotor, (int)d.JointParam.StopCFM, 0f); 1556 SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.StopCFM, 0f);
1560 d.JointSetAMotorParam(Amotor, (int)d.JointParam.StopERP, 0.8f); 1557 SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.StopERP, 0.8f);
1561 i++; 1558 i++;
1562 j = 256; // move to next axis set 1559 j = 256; // move to next axis set
1563 } 1560 }
@@ -1565,17 +1562,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1565 if (axisY) 1562 if (axisY)
1566 { 1563 {
1567 ax = (new Vector3(0, 1, 0)) * curr; 1564 ax = (new Vector3(0, 1, 0)) * curr;
1568 d.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z); 1565 SafeNativeMethods.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z);
1569 d.JointSetAMotorAngle(Amotor, i, 0); 1566 SafeNativeMethods.JointSetAMotorAngle(Amotor, i, 0);
1570 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.LoStop, 0f); 1567 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.LoStop, 0f);
1571 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.HiStop, 0f); 1568 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.HiStop, 0f);
1572 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Vel, 0); 1569 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Vel, 0);
1573 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FudgeFactor, 0.0001f); 1570 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FudgeFactor, 0.0001f);
1574 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Bounce, 0f); 1571 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Bounce, 0f);
1575 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.CFM, 0f); 1572 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.CFM, 0f);
1576 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FMax, 5e8f); 1573 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FMax, 5e8f);
1577 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopCFM, 0f); 1574 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopCFM, 0f);
1578 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopERP, 0.8f); 1575 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopERP, 0.8f);
1579 i++; 1576 i++;
1580 j += 256; 1577 j += 256;
1581 } 1578 }
@@ -1583,17 +1580,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1583 if (axisZ) 1580 if (axisZ)
1584 { 1581 {
1585 ax = (new Vector3(0, 0, 1)) * curr; 1582 ax = (new Vector3(0, 0, 1)) * curr;
1586 d.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z); 1583 SafeNativeMethods.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z);
1587 d.JointSetAMotorAngle(Amotor, i, 0); 1584 SafeNativeMethods.JointSetAMotorAngle(Amotor, i, 0);
1588 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.LoStop, 0f); 1585 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.LoStop, 0f);
1589 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.HiStop, 0f); 1586 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.HiStop, 0f);
1590 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Vel, 0); 1587 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Vel, 0);
1591 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FudgeFactor, 0.0001f); 1588 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FudgeFactor, 0.0001f);
1592 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Bounce, 0f); 1589 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Bounce, 0f);
1593 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.CFM, 0f); 1590 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.CFM, 0f);
1594 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FMax, 5e8f); 1591 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FMax, 5e8f);
1595 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopCFM, 0f); 1592 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopCFM, 0f);
1596 d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopERP, 0.8f); 1593 SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopERP, 0.8f);
1597 } 1594 }
1598 } 1595 }
1599 1596
@@ -1607,21 +1604,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1607 1604
1608 if (m_NoColide) 1605 if (m_NoColide)
1609 { 1606 {
1610 d.GeomSetCategoryBits(prim_geom, 0); 1607 SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
1611 if (m_isphysical) 1608 if (m_isphysical)
1612 { 1609 {
1613 d.GeomSetCollideBits(prim_geom, (uint)CollisionCategories.Land); 1610 SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)CollisionCategories.Land);
1614 } 1611 }
1615 else 1612 else
1616 { 1613 {
1617 d.GeomSetCollideBits(prim_geom, 0); 1614 SafeNativeMethods.GeomSetCollideBits(prim_geom, 0);
1618 d.GeomDisable(prim_geom); 1615 SafeNativeMethods.GeomDisable(prim_geom);
1619 } 1616 }
1620 } 1617 }
1621 else 1618 else
1622 { 1619 {
1623 d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); 1620 SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
1624 d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); 1621 SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
1625 } 1622 }
1626 1623
1627 UpdatePrimBodyData(); 1624 UpdatePrimBodyData();
@@ -1689,12 +1686,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1689 1686
1690 try 1687 try
1691 { 1688 {
1692 _triMeshData = d.GeomTriMeshDataCreate(); 1689 _triMeshData = SafeNativeMethods.GeomTriMeshDataCreate();
1693 1690
1694 d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); 1691 SafeNativeMethods.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride);
1695 d.GeomTriMeshDataPreprocess(_triMeshData); 1692 SafeNativeMethods.GeomTriMeshDataPreprocess(_triMeshData);
1696 1693
1697 geo = d.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null); 1694 geo = SafeNativeMethods.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null);
1698 } 1695 }
1699 1696
1700 catch (Exception e) 1697 catch (Exception e)
@@ -1704,7 +1701,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1704 { 1701 {
1705 try 1702 try
1706 { 1703 {
1707 d.GeomTriMeshDataDestroy(_triMeshData); 1704 SafeNativeMethods.GeomTriMeshDataDestroy(_triMeshData);
1708 } 1705 }
1709 catch 1706 catch
1710 { 1707 {
@@ -1760,7 +1757,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1760 { // it's a sphere 1757 { // it's a sphere
1761 try 1758 try
1762 { 1759 {
1763 geo = d.CreateSphere(m_targetSpace, _size.X * 0.5f); 1760 geo = SafeNativeMethods.CreateSphere(m_targetSpace, _size.X * 0.5f);
1764 } 1761 }
1765 catch (Exception e) 1762 catch (Exception e)
1766 { 1763 {
@@ -1772,7 +1769,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1772 {// do it as a box 1769 {// do it as a box
1773 try 1770 try
1774 { 1771 {
1775 geo = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 1772 geo = SafeNativeMethods.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
1776 } 1773 }
1777 catch (Exception e) 1774 catch (Exception e)
1778 { 1775 {
@@ -1794,10 +1791,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1794 1791
1795 try 1792 try
1796 { 1793 {
1797 d.GeomDestroy(prim_geom); 1794 SafeNativeMethods.GeomDestroy(prim_geom);
1798 if (_triMeshData != IntPtr.Zero) 1795 if (_triMeshData != IntPtr.Zero)
1799 { 1796 {
1800 d.GeomTriMeshDataDestroy(_triMeshData); 1797 SafeNativeMethods.GeomTriMeshDataDestroy(_triMeshData);
1801 _triMeshData = IntPtr.Zero; 1798 _triMeshData = IntPtr.Zero;
1802 } 1799 }
1803 } 1800 }
@@ -1832,7 +1829,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1832 // should only be called for non physical prims unless they are becoming non physical 1829 // should only be called for non physical prims unless they are becoming non physical
1833 private void SetInStaticSpace(OdePrim prim) 1830 private void SetInStaticSpace(OdePrim prim)
1834 { 1831 {
1835 IntPtr targetSpace = _parent_scene.MoveGeomToStaticSpace(prim.prim_geom, prim._position, prim.m_targetSpace); 1832 IntPtr targetSpace = _parent_scene.MoveGeomToStaticSpace(prim.prim_geom, prim.m_targetSpace);
1836 prim.m_targetSpace = targetSpace; 1833 prim.m_targetSpace = targetSpace;
1837 collide_geom = IntPtr.Zero; 1834 collide_geom = IntPtr.Zero;
1838 } 1835 }
@@ -1848,8 +1845,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1848 ApplyCollisionCatFlags(); 1845 ApplyCollisionCatFlags();
1849 1846
1850 _zeroFlag = true; 1847 _zeroFlag = true;
1851 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 1848 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
1852 d.BodyEnable(Body); 1849 SafeNativeMethods.BodyEnable(Body);
1853 } 1850 }
1854 } 1851 }
1855 resetCollisionAccounting(); 1852 resetCollisionAccounting();
@@ -1868,7 +1865,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1868 m_collisionCategories = 0; 1865 m_collisionCategories = 0;
1869 m_collisionFlags = 0; 1866 m_collisionFlags = 0;
1870 ApplyCollisionCatFlags(); 1867 ApplyCollisionCatFlags();
1871 d.BodyDisable(Body); 1868 SafeNativeMethods.BodyDisable(Body);
1872 } 1869 }
1873 } 1870 }
1874 } 1871 }
@@ -1896,41 +1893,41 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1896 m_log.Warn("[PHYSICS]: MakeBody called having a body"); 1893 m_log.Warn("[PHYSICS]: MakeBody called having a body");
1897 } 1894 }
1898 1895
1899 if (d.GeomGetBody(prim_geom) != IntPtr.Zero) 1896 if (SafeNativeMethods.GeomGetBody(prim_geom) != IntPtr.Zero)
1900 { 1897 {
1901 d.GeomSetBody(prim_geom, IntPtr.Zero); 1898 SafeNativeMethods.GeomSetBody(prim_geom, IntPtr.Zero);
1902 m_log.Warn("[PHYSICS]: MakeBody root geom already had a body"); 1899 m_log.Warn("[PHYSICS]: MakeBody root geom already had a body");
1903 } 1900 }
1904 1901
1905 bool noInertiaOverride = (m_InertiaOverride == null); 1902 bool noInertiaOverride = (m_InertiaOverride == null);
1906 1903
1907 Body = d.BodyCreate(_parent_scene.world); 1904 Body = SafeNativeMethods.BodyCreate(_parent_scene.world);
1908 1905
1909 d.Matrix3 mymat = new d.Matrix3(); 1906 SafeNativeMethods.Matrix3 mymat = new SafeNativeMethods.Matrix3();
1910 d.Quaternion myrot = new d.Quaternion(); 1907 SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
1911 d.Mass objdmass = new d.Mass { }; 1908 SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass { };
1912 1909
1913 myrot.X = _orientation.X; 1910 myrot.X = _orientation.X;
1914 myrot.Y = _orientation.Y; 1911 myrot.Y = _orientation.Y;
1915 myrot.Z = _orientation.Z; 1912 myrot.Z = _orientation.Z;
1916 myrot.W = _orientation.W; 1913 myrot.W = _orientation.W;
1917 d.RfromQ(out mymat, ref myrot); 1914 SafeNativeMethods.RfromQ(out mymat, ref myrot);
1918 1915
1919 // set the body rotation 1916 // set the body rotation
1920 d.BodySetRotation(Body, ref mymat); 1917 SafeNativeMethods.BodySetRotation(Body, ref mymat);
1921 1918
1922 if(noInertiaOverride) 1919 if(noInertiaOverride)
1923 { 1920 {
1924 objdmass = primdMass; 1921 objdmass = primdMass;
1925 d.MassRotate(ref objdmass, ref mymat); 1922 SafeNativeMethods.MassRotate(ref objdmass, ref mymat);
1926 } 1923 }
1927 1924
1928 // recompute full object inertia if needed 1925 // recompute full object inertia if needed
1929 if (childrenPrim.Count > 0) 1926 if (childrenPrim.Count > 0)
1930 { 1927 {
1931 d.Matrix3 mat = new d.Matrix3(); 1928 SafeNativeMethods.Matrix3 mat = new SafeNativeMethods.Matrix3();
1932 d.Quaternion quat = new d.Quaternion(); 1929 SafeNativeMethods.Quaternion quat = new SafeNativeMethods.Quaternion();
1933 d.Mass tmpdmass = new d.Mass { }; 1930 SafeNativeMethods.Mass tmpdmass = new SafeNativeMethods.Mass { };
1934 Vector3 rcm; 1931 Vector3 rcm;
1935 1932
1936 rcm.X = _position.X; 1933 rcm.X = _position.X;
@@ -1951,70 +1948,70 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1951 quat.Y = prm._orientation.Y; 1948 quat.Y = prm._orientation.Y;
1952 quat.Z = prm._orientation.Z; 1949 quat.Z = prm._orientation.Z;
1953 quat.W = prm._orientation.W; 1950 quat.W = prm._orientation.W;
1954 d.RfromQ(out mat, ref quat); 1951 SafeNativeMethods.RfromQ(out mat, ref quat);
1955 1952
1956 // fix prim colision cats 1953 // fix prim colision cats
1957 1954
1958 if (d.GeomGetBody(prm.prim_geom) != IntPtr.Zero) 1955 if (SafeNativeMethods.GeomGetBody(prm.prim_geom) != IntPtr.Zero)
1959 { 1956 {
1960 d.GeomSetBody(prm.prim_geom, IntPtr.Zero); 1957 SafeNativeMethods.GeomSetBody(prm.prim_geom, IntPtr.Zero);
1961 m_log.Warn("[PHYSICS]: MakeBody child geom already had a body"); 1958 m_log.Warn("[PHYSICS]: MakeBody child geom already had a body");
1962 } 1959 }
1963 1960
1964 d.GeomClearOffset(prm.prim_geom); 1961 SafeNativeMethods.GeomClearOffset(prm.prim_geom);
1965 d.GeomSetBody(prm.prim_geom, Body); 1962 SafeNativeMethods.GeomSetBody(prm.prim_geom, Body);
1966 prm.Body = Body; 1963 prm.Body = Body;
1967 d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); // set relative rotation 1964 SafeNativeMethods.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); // set relative rotation
1968 1965
1969 if(noInertiaOverride) 1966 if(noInertiaOverride)
1970 { 1967 {
1971 tmpdmass = prm.primdMass; 1968 tmpdmass = prm.primdMass;
1972 1969
1973 d.MassRotate(ref tmpdmass, ref mat); 1970 SafeNativeMethods.MassRotate(ref tmpdmass, ref mat);
1974 Vector3 ppos = prm._position; 1971 Vector3 ppos = prm._position;
1975 ppos.X -= rcm.X; 1972 ppos.X -= rcm.X;
1976 ppos.Y -= rcm.Y; 1973 ppos.Y -= rcm.Y;
1977 ppos.Z -= rcm.Z; 1974 ppos.Z -= rcm.Z;
1978 // refer inertia to root prim center of mass position 1975 // refer inertia to root prim center of mass position
1979 d.MassTranslate(ref tmpdmass, 1976 SafeNativeMethods.MassTranslate(ref tmpdmass,
1980 ppos.X, 1977 ppos.X,
1981 ppos.Y, 1978 ppos.Y,
1982 ppos.Z); 1979 ppos.Z);
1983 1980
1984 d.MassAdd(ref objdmass, ref tmpdmass); // add to total object inertia 1981 SafeNativeMethods.MassAdd(ref objdmass, ref tmpdmass); // add to total object inertia
1985 } 1982 }
1986 } 1983 }
1987 } 1984 }
1988 } 1985 }
1989 1986
1990 d.GeomClearOffset(prim_geom); // make sure we don't have a hidden offset 1987 SafeNativeMethods.GeomClearOffset(prim_geom); // make sure we don't have a hidden offset
1991 // associate root geom with body 1988 // associate root geom with body
1992 d.GeomSetBody(prim_geom, Body); 1989 SafeNativeMethods.GeomSetBody(prim_geom, Body);
1993 1990
1994 if(noInertiaOverride) 1991 if(noInertiaOverride)
1995 d.BodySetPosition(Body, _position.X + objdmass.c.X, _position.Y + objdmass.c.Y, _position.Z + objdmass.c.Z); 1992 SafeNativeMethods.BodySetPosition(Body, _position.X + objdmass.c.X, _position.Y + objdmass.c.Y, _position.Z + objdmass.c.Z);
1996 else 1993 else
1997 { 1994 {
1998 Vector3 ncm = m_InertiaOverride.CenterOfMass * _orientation; 1995 Vector3 ncm = m_InertiaOverride.CenterOfMass * _orientation;
1999 d.BodySetPosition(Body, 1996 SafeNativeMethods.BodySetPosition(Body,
2000 _position.X + ncm.X, 1997 _position.X + ncm.X,
2001 _position.Y + ncm.Y, 1998 _position.Y + ncm.Y,
2002 _position.Z + ncm.Z); 1999 _position.Z + ncm.Z);
2003 } 2000 }
2004 2001
2005 d.GeomSetOffsetWorldPosition(prim_geom, _position.X, _position.Y, _position.Z); 2002 SafeNativeMethods.GeomSetOffsetWorldPosition(prim_geom, _position.X, _position.Y, _position.Z);
2006 2003
2007 if(noInertiaOverride) 2004 if(noInertiaOverride)
2008 { 2005 {
2009 d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body 2006 SafeNativeMethods.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
2010 myrot.X = -myrot.X; 2007 myrot.X = -myrot.X;
2011 myrot.Y = -myrot.Y; 2008 myrot.Y = -myrot.Y;
2012 myrot.Z = -myrot.Z; 2009 myrot.Z = -myrot.Z;
2013 2010
2014 d.RfromQ(out mymat, ref myrot); 2011 SafeNativeMethods.RfromQ(out mymat, ref myrot);
2015 d.MassRotate(ref objdmass, ref mymat); 2012 SafeNativeMethods.MassRotate(ref objdmass, ref mymat);
2016 2013
2017 d.BodySetMass(Body, ref objdmass); 2014 SafeNativeMethods.BodySetMass(Body, ref objdmass);
2018 m_mass = objdmass.mass; 2015 m_mass = objdmass.mass;
2019 } 2016 }
2020 else 2017 else
@@ -2031,35 +2028,35 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2031 2028
2032 if(Math.Abs(m_InertiaOverride.InertiaRotation.W) < 0.999) 2029 if(Math.Abs(m_InertiaOverride.InertiaRotation.W) < 0.999)
2033 { 2030 {
2034 d.Matrix3 inertiarotmat = new d.Matrix3(); 2031 SafeNativeMethods.Matrix3 inertiarotmat = new SafeNativeMethods.Matrix3();
2035 d.Quaternion inertiarot = new d.Quaternion(); 2032 SafeNativeMethods.Quaternion inertiarot = new SafeNativeMethods.Quaternion();
2036 2033
2037 inertiarot.X = m_InertiaOverride.InertiaRotation.X; 2034 inertiarot.X = m_InertiaOverride.InertiaRotation.X;
2038 inertiarot.Y = m_InertiaOverride.InertiaRotation.Y; 2035 inertiarot.Y = m_InertiaOverride.InertiaRotation.Y;
2039 inertiarot.Z = m_InertiaOverride.InertiaRotation.Z; 2036 inertiarot.Z = m_InertiaOverride.InertiaRotation.Z;
2040 inertiarot.W = m_InertiaOverride.InertiaRotation.W; 2037 inertiarot.W = m_InertiaOverride.InertiaRotation.W;
2041 d.RfromQ(out inertiarotmat, ref inertiarot); 2038 SafeNativeMethods.RfromQ(out inertiarotmat, ref inertiarot);
2042 d.MassRotate(ref objdmass, ref inertiarotmat); 2039 SafeNativeMethods.MassRotate(ref objdmass, ref inertiarotmat);
2043 } 2040 }
2044 d.BodySetMass(Body, ref objdmass); 2041 SafeNativeMethods.BodySetMass(Body, ref objdmass);
2045 2042
2046 m_mass = objdmass.mass; 2043 m_mass = objdmass.mass;
2047 } 2044 }
2048 2045
2049 // disconnect from world gravity so we can apply buoyancy 2046 // disconnect from world gravity so we can apply buoyancy
2050 d.BodySetGravityMode(Body, false); 2047 SafeNativeMethods.BodySetGravityMode(Body, false);
2051 2048
2052 d.BodySetAutoDisableFlag(Body, true); 2049 SafeNativeMethods.BodySetAutoDisableFlag(Body, true);
2053 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 2050 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
2054 d.BodySetAutoDisableAngularThreshold(Body, 0.05f); 2051 SafeNativeMethods.BodySetAutoDisableAngularThreshold(Body, 0.05f);
2055 d.BodySetAutoDisableLinearThreshold(Body, 0.05f); 2052 SafeNativeMethods.BodySetAutoDisableLinearThreshold(Body, 0.05f);
2056 d.BodySetDamping(Body, .004f, .001f); 2053 SafeNativeMethods.BodySetDamping(Body, .004f, .001f);
2057 2054
2058 if (m_targetSpace != IntPtr.Zero) 2055 if (m_targetSpace != IntPtr.Zero)
2059 { 2056 {
2060 _parent_scene.waitForSpaceUnlock(m_targetSpace); 2057 _parent_scene.waitForSpaceUnlock(m_targetSpace);
2061 if (d.SpaceQuery(m_targetSpace, prim_geom)) 2058 if (SafeNativeMethods.SpaceQuery(m_targetSpace, prim_geom))
2062 d.SpaceRemove(m_targetSpace, prim_geom); 2059 SafeNativeMethods.SpaceRemove(m_targetSpace, prim_geom);
2063 } 2060 }
2064 2061
2065 if (childrenPrim.Count == 0) 2062 if (childrenPrim.Count == 0)
@@ -2069,21 +2066,23 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2069 } 2066 }
2070 else 2067 else
2071 { 2068 {
2072 m_targetSpace = d.HashSpaceCreate(_parent_scene.ActiveSpace); 2069 m_targetSpace = SafeNativeMethods.SimpleSpaceCreate(_parent_scene.ActiveSpace);
2073 d.HashSpaceSetLevels(m_targetSpace, -2, 8); 2070 SafeNativeMethods.SpaceSetSublevel(m_targetSpace, 3);
2074 d.SpaceSetSublevel(m_targetSpace, 3); 2071 SafeNativeMethods.SpaceSetCleanup(m_targetSpace, false);
2075 d.SpaceSetCleanup(m_targetSpace, false);
2076 2072
2077 d.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space | 2073 SafeNativeMethods.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space |
2078 CollisionCategories.Geom | 2074 CollisionCategories.Geom |
2079 CollisionCategories.Phantom | 2075 CollisionCategories.Phantom |
2080 CollisionCategories.VolumeDtc 2076 CollisionCategories.VolumeDtc
2081 )); 2077 ));
2082 d.GeomSetCollideBits(m_targetSpace, 0); 2078 SafeNativeMethods.GeomSetCollideBits(m_targetSpace, 0);
2083 collide_geom = m_targetSpace; 2079 collide_geom = m_targetSpace;
2084 } 2080 }
2085 2081
2086 d.SpaceAdd(m_targetSpace, prim_geom); 2082 if (SafeNativeMethods.SpaceQuery(m_targetSpace, prim_geom))
2083 m_log.Debug("[PRIM]: parent already in target space");
2084 else
2085 SafeNativeMethods.SpaceAdd(m_targetSpace, prim_geom);
2087 2086
2088 if (m_delaySelect) 2087 if (m_delaySelect)
2089 { 2088 {
@@ -2102,22 +2101,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2102 { 2101 {
2103 foreach (OdePrim prm in childrenPrim) 2102 foreach (OdePrim prm in childrenPrim)
2104 { 2103 {
2105 if (prm.prim_geom == IntPtr.Zero) 2104 IntPtr prmgeom = prm.prim_geom;
2105 if (prmgeom == IntPtr.Zero)
2106 continue; 2106 continue;
2107 2107
2108 Vector3 ppos = prm._position; 2108 Vector3 ppos = prm._position;
2109 d.GeomSetOffsetWorldPosition(prm.prim_geom, ppos.X, ppos.Y, ppos.Z); // set relative position 2109 SafeNativeMethods.GeomSetOffsetWorldPosition(prm.prim_geom, ppos.X, ppos.Y, ppos.Z); // set relative position
2110 2110
2111 if (prm.m_targetSpace != m_targetSpace) 2111 IntPtr prmspace = prm.m_targetSpace;
2112 if (prmspace != m_targetSpace)
2112 { 2113 {
2113 if (prm.m_targetSpace != IntPtr.Zero) 2114 if (prmspace != IntPtr.Zero)
2114 { 2115 {
2115 _parent_scene.waitForSpaceUnlock(prm.m_targetSpace); 2116 _parent_scene.waitForSpaceUnlock(prmspace);
2116 if (d.SpaceQuery(prm.m_targetSpace, prm.prim_geom)) 2117 if (SafeNativeMethods.SpaceQuery(prmspace, prmgeom))
2117 d.SpaceRemove(prm.m_targetSpace, prm.prim_geom); 2118 SafeNativeMethods.SpaceRemove(prmspace, prmgeom);
2118 } 2119 }
2119 prm.m_targetSpace = m_targetSpace; 2120 prm.m_targetSpace = m_targetSpace;
2120 d.SpaceAdd(m_targetSpace, prm.prim_geom); 2121 if (SafeNativeMethods.SpaceQuery(m_targetSpace, prmgeom))
2122 m_log.Debug("[PRIM]: child already in target space");
2123 else
2124 SafeNativeMethods.SpaceAdd(m_targetSpace, prmgeom);
2121 } 2125 }
2122 2126
2123 prm.m_collisionscore = 0; 2127 prm.m_collisionscore = 0;
@@ -2137,13 +2141,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2137 2141
2138 if (m_isSelected || m_disabled) 2142 if (m_isSelected || m_disabled)
2139 { 2143 {
2140 d.BodyDisable(Body); 2144 SafeNativeMethods.BodyDisable(Body);
2141 _zeroFlag = true; 2145 _zeroFlag = true;
2142 } 2146 }
2143 else 2147 else
2144 { 2148 {
2145 d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); 2149 SafeNativeMethods.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z);
2146 d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); 2150 SafeNativeMethods.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
2147 2151
2148 _zeroFlag = false; 2152 _zeroFlag = false;
2149 m_bodydisablecontrol = 0; 2153 m_bodydisablecontrol = 0;
@@ -2176,16 +2180,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2176 { 2180 {
2177 if (m_NoColide) 2181 if (m_NoColide)
2178 { 2182 {
2179 d.GeomSetCategoryBits(prim_geom, 0); 2183 SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
2180 d.GeomSetCollideBits(prim_geom, 0); 2184 SafeNativeMethods.GeomSetCollideBits(prim_geom, 0);
2181 } 2185 }
2182 else 2186 else
2183 { 2187 {
2184 d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); 2188 SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
2185 d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); 2189 SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
2186 } 2190 }
2187 UpdateDataFromGeom(); 2191 UpdateDataFromGeom();
2188 d.GeomSetBody(prim_geom, IntPtr.Zero); 2192 SafeNativeMethods.GeomSetBody(prim_geom, IntPtr.Zero);
2189 SetInStaticSpace(this); 2193 SetInStaticSpace(this);
2190 } 2194 }
2191 2195
@@ -2212,13 +2216,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2212 { 2216 {
2213 if (prm.m_NoColide) 2217 if (prm.m_NoColide)
2214 { 2218 {
2215 d.GeomSetCategoryBits(prm.prim_geom, 0); 2219 SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, 0);
2216 d.GeomSetCollideBits(prm.prim_geom, 0); 2220 SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, 0);
2217 } 2221 }
2218 else 2222 else
2219 { 2223 {
2220 d.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories); 2224 SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories);
2221 d.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags); 2225 SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags);
2222 } 2226 }
2223 prm.UpdateDataFromGeom(); 2227 prm.UpdateDataFromGeom();
2224 SetInStaticSpace(prm); 2228 SetInStaticSpace(prm);
@@ -2230,11 +2234,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2230 } 2234 }
2231 if (Amotor != IntPtr.Zero) 2235 if (Amotor != IntPtr.Zero)
2232 { 2236 {
2233 d.JointDestroy(Amotor); 2237 SafeNativeMethods.JointDestroy(Amotor);
2234 Amotor = IntPtr.Zero; 2238 Amotor = IntPtr.Zero;
2235 } 2239 }
2236 _parent_scene.remActiveGroup(this); 2240 _parent_scene.remActiveGroup(this);
2237 d.BodyDestroy(Body); 2241 SafeNativeMethods.BodyDestroy(Body);
2238 } 2242 }
2239 Body = IntPtr.Zero; 2243 Body = IntPtr.Zero;
2240 } 2244 }
@@ -2244,30 +2248,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2244 2248
2245 private void FixInertia(Vector3 NewPos,Quaternion newrot) 2249 private void FixInertia(Vector3 NewPos,Quaternion newrot)
2246 { 2250 {
2247 d.Matrix3 mat = new d.Matrix3(); 2251 SafeNativeMethods.Matrix3 mat = new SafeNativeMethods.Matrix3();
2248 d.Quaternion quat = new d.Quaternion(); 2252 SafeNativeMethods.Quaternion quat = new SafeNativeMethods.Quaternion();
2249 2253
2250 d.Mass tmpdmass = new d.Mass { }; 2254 SafeNativeMethods.Mass tmpdmass = new SafeNativeMethods.Mass { };
2251 d.Mass objdmass = new d.Mass { }; 2255 SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass { };
2252 2256
2253 d.BodyGetMass(Body, out tmpdmass); 2257 SafeNativeMethods.BodyGetMass(Body, out tmpdmass);
2254 objdmass = tmpdmass; 2258 objdmass = tmpdmass;
2255 2259
2256 d.Vector3 dobjpos; 2260 SafeNativeMethods.Vector3 dobjpos;
2257 d.Vector3 thispos; 2261 SafeNativeMethods.Vector3 thispos;
2258 2262
2259 // get current object position and rotation 2263 // get current object position and rotation
2260 dobjpos = d.BodyGetPosition(Body); 2264 dobjpos = SafeNativeMethods.BodyGetPosition(Body);
2261 2265
2262 // get prim own inertia in its local frame 2266 // get prim own inertia in its local frame
2263 tmpdmass = primdMass; 2267 tmpdmass = primdMass;
2264 2268
2265 // transform to object frame 2269 // transform to object frame
2266 mat = d.GeomGetOffsetRotation(prim_geom); 2270 mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom);
2267 d.MassRotate(ref tmpdmass, ref mat); 2271 SafeNativeMethods.MassRotate(ref tmpdmass, ref mat);
2268 2272
2269 thispos = d.GeomGetOffsetPosition(prim_geom); 2273 thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom);
2270 d.MassTranslate(ref tmpdmass, 2274 SafeNativeMethods.MassTranslate(ref tmpdmass,
2271 thispos.X, 2275 thispos.X,
2272 thispos.Y, 2276 thispos.Y,
2273 thispos.Z); 2277 thispos.Z);
@@ -2280,66 +2284,66 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2280 2284
2281 // update to new position and orientation 2285 // update to new position and orientation
2282 _position = NewPos; 2286 _position = NewPos;
2283 d.GeomSetOffsetWorldPosition(prim_geom, NewPos.X, NewPos.Y, NewPos.Z); 2287 SafeNativeMethods.GeomSetOffsetWorldPosition(prim_geom, NewPos.X, NewPos.Y, NewPos.Z);
2284 _orientation = newrot; 2288 _orientation = newrot;
2285 quat.X = newrot.X; 2289 quat.X = newrot.X;
2286 quat.Y = newrot.Y; 2290 quat.Y = newrot.Y;
2287 quat.Z = newrot.Z; 2291 quat.Z = newrot.Z;
2288 quat.W = newrot.W; 2292 quat.W = newrot.W;
2289 d.GeomSetOffsetWorldQuaternion(prim_geom, ref quat); 2293 SafeNativeMethods.GeomSetOffsetWorldQuaternion(prim_geom, ref quat);
2290 2294
2291 mat = d.GeomGetOffsetRotation(prim_geom); 2295 mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom);
2292 d.MassRotate(ref tmpdmass, ref mat); 2296 SafeNativeMethods.MassRotate(ref tmpdmass, ref mat);
2293 2297
2294 thispos = d.GeomGetOffsetPosition(prim_geom); 2298 thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom);
2295 d.MassTranslate(ref tmpdmass, 2299 SafeNativeMethods.MassTranslate(ref tmpdmass,
2296 thispos.X, 2300 thispos.X,
2297 thispos.Y, 2301 thispos.Y,
2298 thispos.Z); 2302 thispos.Z);
2299 2303
2300 d.MassAdd(ref objdmass, ref tmpdmass); 2304 SafeNativeMethods.MassAdd(ref objdmass, ref tmpdmass);
2301 2305
2302 // fix all positions 2306 // fix all positions
2303 IntPtr g = d.BodyGetFirstGeom(Body); 2307 IntPtr g = SafeNativeMethods.BodyGetFirstGeom(Body);
2304 while (g != IntPtr.Zero) 2308 while (g != IntPtr.Zero)
2305 { 2309 {
2306 thispos = d.GeomGetOffsetPosition(g); 2310 thispos = SafeNativeMethods.GeomGetOffsetPosition(g);
2307 thispos.X -= objdmass.c.X; 2311 thispos.X -= objdmass.c.X;
2308 thispos.Y -= objdmass.c.Y; 2312 thispos.Y -= objdmass.c.Y;
2309 thispos.Z -= objdmass.c.Z; 2313 thispos.Z -= objdmass.c.Z;
2310 d.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z); 2314 SafeNativeMethods.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z);
2311 g = d.dBodyGetNextGeom(g); 2315 g = SafeNativeMethods.dBodyGetNextGeom(g);
2312 } 2316 }
2313 d.BodyVectorToWorld(Body,objdmass.c.X, objdmass.c.Y, objdmass.c.Z,out thispos); 2317 SafeNativeMethods.BodyVectorToWorld(Body,objdmass.c.X, objdmass.c.Y, objdmass.c.Z,out thispos);
2314 2318
2315 d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z); 2319 SafeNativeMethods.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
2316 d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body 2320 SafeNativeMethods.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
2317 d.BodySetMass(Body, ref objdmass); 2321 SafeNativeMethods.BodySetMass(Body, ref objdmass);
2318 m_mass = objdmass.mass; 2322 m_mass = objdmass.mass;
2319 } 2323 }
2320 2324
2321 private void FixInertia(Vector3 NewPos) 2325 private void FixInertia(Vector3 NewPos)
2322 { 2326 {
2323 d.Matrix3 primmat = new d.Matrix3(); 2327 SafeNativeMethods.Matrix3 primmat = new SafeNativeMethods.Matrix3();
2324 d.Mass tmpdmass = new d.Mass { }; 2328 SafeNativeMethods.Mass tmpdmass = new SafeNativeMethods.Mass { };
2325 d.Mass objdmass = new d.Mass { }; 2329 SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass { };
2326 d.Mass primmass = new d.Mass { }; 2330 SafeNativeMethods.Mass primmass = new SafeNativeMethods.Mass { };
2327 2331
2328 d.Vector3 dobjpos; 2332 SafeNativeMethods.Vector3 dobjpos;
2329 d.Vector3 thispos; 2333 SafeNativeMethods.Vector3 thispos;
2330 2334
2331 d.BodyGetMass(Body, out objdmass); 2335 SafeNativeMethods.BodyGetMass(Body, out objdmass);
2332 2336
2333 // get prim own inertia in its local frame 2337 // get prim own inertia in its local frame
2334 primmass = primdMass; 2338 primmass = primdMass;
2335 // transform to object frame 2339 // transform to object frame
2336 primmat = d.GeomGetOffsetRotation(prim_geom); 2340 primmat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom);
2337 d.MassRotate(ref primmass, ref primmat); 2341 SafeNativeMethods.MassRotate(ref primmass, ref primmat);
2338 2342
2339 tmpdmass = primmass; 2343 tmpdmass = primmass;
2340 2344
2341 thispos = d.GeomGetOffsetPosition(prim_geom); 2345 thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom);
2342 d.MassTranslate(ref tmpdmass, 2346 SafeNativeMethods.MassTranslate(ref tmpdmass,
2343 thispos.X, 2347 thispos.X,
2344 thispos.Y, 2348 thispos.Y,
2345 thispos.Z); 2349 thispos.Z);
@@ -2349,58 +2353,58 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2349 2353
2350 // update to new position 2354 // update to new position
2351 _position = NewPos; 2355 _position = NewPos;
2352 d.GeomSetOffsetWorldPosition(prim_geom, NewPos.X, NewPos.Y, NewPos.Z); 2356 SafeNativeMethods.GeomSetOffsetWorldPosition(prim_geom, NewPos.X, NewPos.Y, NewPos.Z);
2353 2357
2354 thispos = d.GeomGetOffsetPosition(prim_geom); 2358 thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom);
2355 d.MassTranslate(ref primmass, 2359 SafeNativeMethods.MassTranslate(ref primmass,
2356 thispos.X, 2360 thispos.X,
2357 thispos.Y, 2361 thispos.Y,
2358 thispos.Z); 2362 thispos.Z);
2359 2363
2360 d.MassAdd(ref objdmass, ref primmass); 2364 SafeNativeMethods.MassAdd(ref objdmass, ref primmass);
2361 2365
2362 // fix all positions 2366 // fix all positions
2363 IntPtr g = d.BodyGetFirstGeom(Body); 2367 IntPtr g = SafeNativeMethods.BodyGetFirstGeom(Body);
2364 while (g != IntPtr.Zero) 2368 while (g != IntPtr.Zero)
2365 { 2369 {
2366 thispos = d.GeomGetOffsetPosition(g); 2370 thispos = SafeNativeMethods.GeomGetOffsetPosition(g);
2367 thispos.X -= objdmass.c.X; 2371 thispos.X -= objdmass.c.X;
2368 thispos.Y -= objdmass.c.Y; 2372 thispos.Y -= objdmass.c.Y;
2369 thispos.Z -= objdmass.c.Z; 2373 thispos.Z -= objdmass.c.Z;
2370 d.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z); 2374 SafeNativeMethods.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z);
2371 g = d.dBodyGetNextGeom(g); 2375 g = SafeNativeMethods.dBodyGetNextGeom(g);
2372 } 2376 }
2373 2377
2374 d.BodyVectorToWorld(Body, objdmass.c.X, objdmass.c.Y, objdmass.c.Z, out thispos); 2378 SafeNativeMethods.BodyVectorToWorld(Body, objdmass.c.X, objdmass.c.Y, objdmass.c.Z, out thispos);
2375 2379
2376 // get current object position and rotation 2380 // get current object position and rotation
2377 dobjpos = d.BodyGetPosition(Body); 2381 dobjpos = SafeNativeMethods.BodyGetPosition(Body);
2378 2382
2379 d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z); 2383 SafeNativeMethods.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
2380 d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body 2384 SafeNativeMethods.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
2381 d.BodySetMass(Body, ref objdmass); 2385 SafeNativeMethods.BodySetMass(Body, ref objdmass);
2382 m_mass = objdmass.mass; 2386 m_mass = objdmass.mass;
2383 } 2387 }
2384 2388
2385 private void FixInertia(Quaternion newrot) 2389 private void FixInertia(Quaternion newrot)
2386 { 2390 {
2387 d.Matrix3 mat = new d.Matrix3(); 2391 SafeNativeMethods.Matrix3 mat = new SafeNativeMethods.Matrix3();
2388 d.Quaternion quat = new d.Quaternion(); 2392 SafeNativeMethods.Quaternion quat = new SafeNativeMethods.Quaternion();
2389 2393
2390 d.Mass tmpdmass = new d.Mass { }; 2394 SafeNativeMethods.Mass tmpdmass = new SafeNativeMethods.Mass { };
2391 d.Mass objdmass = new d.Mass { }; 2395 SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass { };
2392 d.Vector3 dobjpos; 2396 SafeNativeMethods.Vector3 dobjpos;
2393 d.Vector3 thispos; 2397 SafeNativeMethods.Vector3 thispos;
2394 2398
2395 d.BodyGetMass(Body, out objdmass); 2399 SafeNativeMethods.BodyGetMass(Body, out objdmass);
2396 2400
2397 // get prim own inertia in its local frame 2401 // get prim own inertia in its local frame
2398 tmpdmass = primdMass; 2402 tmpdmass = primdMass;
2399 mat = d.GeomGetOffsetRotation(prim_geom); 2403 mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom);
2400 d.MassRotate(ref tmpdmass, ref mat); 2404 SafeNativeMethods.MassRotate(ref tmpdmass, ref mat);
2401 // transform to object frame 2405 // transform to object frame
2402 thispos = d.GeomGetOffsetPosition(prim_geom); 2406 thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom);
2403 d.MassTranslate(ref tmpdmass, 2407 SafeNativeMethods.MassTranslate(ref tmpdmass,
2404 thispos.X, 2408 thispos.X,
2405 thispos.Y, 2409 thispos.Y,
2406 thispos.Z); 2410 thispos.Z);
@@ -2414,37 +2418,37 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2414 quat.Y = newrot.Y; 2418 quat.Y = newrot.Y;
2415 quat.Z = newrot.Z; 2419 quat.Z = newrot.Z;
2416 quat.W = newrot.W; 2420 quat.W = newrot.W;
2417 d.GeomSetOffsetWorldQuaternion(prim_geom, ref quat); 2421 SafeNativeMethods.GeomSetOffsetWorldQuaternion(prim_geom, ref quat);
2418 2422
2419 tmpdmass = primdMass; 2423 tmpdmass = primdMass;
2420 mat = d.GeomGetOffsetRotation(prim_geom); 2424 mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom);
2421 d.MassRotate(ref tmpdmass, ref mat); 2425 SafeNativeMethods.MassRotate(ref tmpdmass, ref mat);
2422 d.MassTranslate(ref tmpdmass, 2426 SafeNativeMethods.MassTranslate(ref tmpdmass,
2423 thispos.X, 2427 thispos.X,
2424 thispos.Y, 2428 thispos.Y,
2425 thispos.Z); 2429 thispos.Z);
2426 2430
2427 d.MassAdd(ref objdmass, ref tmpdmass); 2431 SafeNativeMethods.MassAdd(ref objdmass, ref tmpdmass);
2428 2432
2429 // fix all positions 2433 // fix all positions
2430 IntPtr g = d.BodyGetFirstGeom(Body); 2434 IntPtr g = SafeNativeMethods.BodyGetFirstGeom(Body);
2431 while (g != IntPtr.Zero) 2435 while (g != IntPtr.Zero)
2432 { 2436 {
2433 thispos = d.GeomGetOffsetPosition(g); 2437 thispos = SafeNativeMethods.GeomGetOffsetPosition(g);
2434 thispos.X -= objdmass.c.X; 2438 thispos.X -= objdmass.c.X;
2435 thispos.Y -= objdmass.c.Y; 2439 thispos.Y -= objdmass.c.Y;
2436 thispos.Z -= objdmass.c.Z; 2440 thispos.Z -= objdmass.c.Z;
2437 d.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z); 2441 SafeNativeMethods.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z);
2438 g = d.dBodyGetNextGeom(g); 2442 g = SafeNativeMethods.dBodyGetNextGeom(g);
2439 } 2443 }
2440 2444
2441 d.BodyVectorToWorld(Body, objdmass.c.X, objdmass.c.Y, objdmass.c.Z, out thispos); 2445 SafeNativeMethods.BodyVectorToWorld(Body, objdmass.c.X, objdmass.c.Y, objdmass.c.Z, out thispos);
2442 // get current object position and rotation 2446 // get current object position and rotation
2443 dobjpos = d.BodyGetPosition(Body); 2447 dobjpos = SafeNativeMethods.BodyGetPosition(Body);
2444 2448
2445 d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z); 2449 SafeNativeMethods.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
2446 d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body 2450 SafeNativeMethods.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
2447 d.BodySetMass(Body, ref objdmass); 2451 SafeNativeMethods.BodySetMass(Body, ref objdmass);
2448 m_mass = objdmass.mass; 2452 m_mass = objdmass.mass;
2449 } 2453 }
2450 2454
@@ -2462,9 +2466,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2462 2466
2463 m_mass = primMass; // just in case 2467 m_mass = primMass; // just in case
2464 2468
2465 d.MassSetBoxTotal(out primdMass, primMass, 2.0f * m_OBB.X, 2.0f * m_OBB.Y, 2.0f * m_OBB.Z); 2469 SafeNativeMethods.MassSetBoxTotal(out primdMass, primMass, 2.0f * m_OBB.X, 2.0f * m_OBB.Y, 2.0f * m_OBB.Z);
2466 2470
2467 d.MassTranslate(ref primdMass, 2471 SafeNativeMethods.MassTranslate(ref primdMass,
2468 m_OBBOffset.X, 2472 m_OBBOffset.X,
2469 m_OBBOffset.Y, 2473 m_OBBOffset.Y,
2470 m_OBBOffset.Z); 2474 m_OBBOffset.Z);
@@ -2519,7 +2523,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2519 if (prm.Body != IntPtr.Zero) 2523 if (prm.Body != IntPtr.Zero)
2520 { 2524 {
2521 if (prm.prim_geom != IntPtr.Zero) 2525 if (prm.prim_geom != IntPtr.Zero)
2522 d.GeomSetBody(prm.prim_geom, IntPtr.Zero); 2526 SafeNativeMethods.GeomSetBody(prm.prim_geom, IntPtr.Zero);
2523 if (prm.Body != prim.Body) 2527 if (prm.Body != prim.Body)
2524 prm.DestroyBody(); // don't loose bodies around 2528 prm.DestroyBody(); // don't loose bodies around
2525 prm.Body = IntPtr.Zero; 2529 prm.Body = IntPtr.Zero;
@@ -2536,7 +2540,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2536 if (prim.Body != IntPtr.Zero) 2540 if (prim.Body != IntPtr.Zero)
2537 { 2541 {
2538 if (prim.prim_geom != IntPtr.Zero) 2542 if (prim.prim_geom != IntPtr.Zero)
2539 d.GeomSetBody(prim.prim_geom, IntPtr.Zero); 2543 SafeNativeMethods.GeomSetBody(prim.prim_geom, IntPtr.Zero);
2540 prim.DestroyBody(); // don't loose bodies around 2544 prim.DestroyBody(); // don't loose bodies around
2541 prim.Body = IntPtr.Zero; 2545 prim.Body = IntPtr.Zero;
2542 } 2546 }
@@ -2561,8 +2565,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2561 { 2565 {
2562 if (prim_geom != IntPtr.Zero) 2566 if (prim_geom != IntPtr.Zero)
2563 { 2567 {
2564 d.Quaternion qtmp; 2568 SafeNativeMethods.Quaternion qtmp;
2565 d.GeomCopyQuaternion(prim_geom, out qtmp); 2569 SafeNativeMethods.GeomCopyQuaternion(prim_geom, out qtmp);
2566 _orientation.X = qtmp.X; 2570 _orientation.X = qtmp.X;
2567 _orientation.Y = qtmp.Y; 2571 _orientation.Y = qtmp.Y;
2568 _orientation.Z = qtmp.Z; 2572 _orientation.Z = qtmp.Z;
@@ -2576,7 +2580,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2576*/ 2580*/
2577 _orientation.Normalize(); 2581 _orientation.Normalize();
2578 2582
2579 d.Vector3 lpos = d.GeomGetPosition(prim_geom); 2583 SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(prim_geom);
2580 _position.X = lpos.X; 2584 _position.X = lpos.X;
2581 _position.Y = lpos.Y; 2585 _position.Y = lpos.Y;
2582 _position.Z = lpos.Z; 2586 _position.Z = lpos.Z;
@@ -2705,7 +2709,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2705 { 2709 {
2706 if (Amotor != IntPtr.Zero) 2710 if (Amotor != IntPtr.Zero)
2707 { 2711 {
2708 d.JointDestroy(Amotor); 2712 SafeNativeMethods.JointDestroy(Amotor);
2709 Amotor = IntPtr.Zero; 2713 Amotor = IntPtr.Zero;
2710 } 2714 }
2711 } 2715 }
@@ -2762,10 +2766,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2762 2766
2763 if (Body != IntPtr.Zero) 2767 if (Body != IntPtr.Zero)
2764 { 2768 {
2765 d.BodySetForce(Body, 0f, 0f, 0f); 2769 SafeNativeMethods.BodySetForce(Body, 0f, 0f, 0f);
2766 d.BodySetTorque(Body, 0f, 0f, 0f); 2770 SafeNativeMethods.BodySetTorque(Body, 0f, 0f, 0f);
2767 d.BodySetLinearVel(Body, 0f, 0f, 0f); 2771 SafeNativeMethods.BodySetLinearVel(Body, 0f, 0f, 0f);
2768 d.BodySetAngularVel(Body, 0f, 0f, 0f); 2772 SafeNativeMethods.BodySetAngularVel(Body, 0f, 0f, 0f);
2769 } 2773 }
2770 } 2774 }
2771 2775
@@ -2827,7 +2831,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2827 if (newval) 2831 if (newval)
2828 { 2832 {
2829 if (!childPrim && Body != IntPtr.Zero) 2833 if (!childPrim && Body != IntPtr.Zero)
2830 d.BodyDisable(Body); 2834 SafeNativeMethods.BodyDisable(Body);
2831 2835
2832 if (m_delaySelect || m_isphysical) 2836 if (m_delaySelect || m_isphysical)
2833 { 2837 {
@@ -2846,13 +2850,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2846 2850
2847 if (prm.m_NoColide) 2851 if (prm.m_NoColide)
2848 { 2852 {
2849 d.GeomSetCategoryBits(prm.prim_geom, 0); 2853 SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, 0);
2850 d.GeomSetCollideBits(prm.prim_geom, 0); 2854 SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, 0);
2851 } 2855 }
2852 else 2856 else
2853 { 2857 {
2854 d.GeomSetCategoryBits(prm.prim_geom, (uint)m_collisionCategories); 2858 SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, (uint)m_collisionCategories);
2855 d.GeomSetCollideBits(prm.prim_geom, (uint)m_collisionFlags); 2859 SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)m_collisionFlags);
2856 } 2860 }
2857 } 2861 }
2858 prm.m_delaySelect = false; 2862 prm.m_delaySelect = false;
@@ -2866,23 +2870,23 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2866 { 2870 {
2867 if (m_NoColide) 2871 if (m_NoColide)
2868 { 2872 {
2869 d.GeomSetCategoryBits(prim_geom, 0); 2873 SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0);
2870 d.GeomSetCollideBits(prim_geom, 0); 2874 SafeNativeMethods.GeomSetCollideBits(prim_geom, 0);
2871 if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) 2875 if (collide_geom != prim_geom && collide_geom != IntPtr.Zero)
2872 { 2876 {
2873 d.GeomSetCategoryBits(collide_geom, 0); 2877 SafeNativeMethods.GeomSetCategoryBits(collide_geom, 0);
2874 d.GeomSetCollideBits(collide_geom, 0); 2878 SafeNativeMethods.GeomSetCollideBits(collide_geom, 0);
2875 } 2879 }
2876 2880
2877 } 2881 }
2878 else 2882 else
2879 { 2883 {
2880 d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); 2884 SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories);
2881 d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); 2885 SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags);
2882 if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) 2886 if (collide_geom != prim_geom && collide_geom != IntPtr.Zero)
2883 { 2887 {
2884 d.GeomSetCategoryBits(collide_geom, (uint)m_collisionCategories); 2888 SafeNativeMethods.GeomSetCategoryBits(collide_geom, (uint)m_collisionCategories);
2885 d.GeomSetCollideBits(collide_geom, (uint)m_collisionFlags); 2889 SafeNativeMethods.GeomSetCollideBits(collide_geom, (uint)m_collisionFlags);
2886 } 2890 }
2887 } 2891 }
2888 } 2892 }
@@ -2901,8 +2905,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2901 if (Body != IntPtr.Zero && !m_disabled) 2905 if (Body != IntPtr.Zero && !m_disabled)
2902 { 2906 {
2903 _zeroFlag = true; 2907 _zeroFlag = true;
2904 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 2908 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
2905 d.BodyEnable(Body); 2909 SafeNativeMethods.BodyEnable(Body);
2906 } 2910 }
2907 } 2911 }
2908// else if (_parent != null) 2912// else if (_parent != null)
@@ -2932,11 +2936,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2932 else if (m_forcePosOrRotation && _position != newPos && Body != IntPtr.Zero) 2936 else if (m_forcePosOrRotation && _position != newPos && Body != IntPtr.Zero)
2933 { 2937 {
2934 FixInertia(newPos); 2938 FixInertia(newPos);
2935 if (!d.BodyIsEnabled(Body)) 2939 if (!SafeNativeMethods.BodyIsEnabled(Body))
2936 { 2940 {
2937 _zeroFlag = true; 2941 _zeroFlag = true;
2938 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 2942 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
2939 d.BodyEnable(Body); 2943 SafeNativeMethods.BodyEnable(Body);
2940 } 2944 }
2941 } 2945 }
2942 } 2946 }
@@ -2944,14 +2948,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2944 { 2948 {
2945 if (_position != newPos) 2949 if (_position != newPos)
2946 { 2950 {
2947 d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); 2951 SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z);
2948 _position = newPos; 2952 _position = newPos;
2949 } 2953 }
2950 if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) 2954 if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body))
2951 { 2955 {
2952 _zeroFlag = true; 2956 _zeroFlag = true;
2953 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 2957 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
2954 d.BodyEnable(Body); 2958 SafeNativeMethods.BodyEnable(Body);
2955 } 2959 }
2956 } 2960 }
2957 } 2961 }
@@ -2961,10 +2965,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2961 { 2965 {
2962 if (newPos != _position) 2966 if (newPos != _position)
2963 { 2967 {
2964 d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); 2968 SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z);
2965 _position = newPos; 2969 _position = newPos;
2966 2970
2967 m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, _position, m_targetSpace); 2971 m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, m_targetSpace);
2968 } 2972 }
2969 } 2973 }
2970 } 2974 }
@@ -2999,12 +3003,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2999 { 3003 {
3000 if (newOri != _orientation) 3004 if (newOri != _orientation)
3001 { 3005 {
3002 d.Quaternion myrot = new d.Quaternion(); 3006 SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
3003 myrot.X = newOri.X; 3007 myrot.X = newOri.X;
3004 myrot.Y = newOri.Y; 3008 myrot.Y = newOri.Y;
3005 myrot.Z = newOri.Z; 3009 myrot.Z = newOri.Z;
3006 myrot.W = newOri.W; 3010 myrot.W = newOri.W;
3007 d.GeomSetQuaternion(prim_geom, ref myrot); 3011 SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot);
3008 _orientation = newOri; 3012 _orientation = newOri;
3009 3013
3010 if (Body != IntPtr.Zero) 3014 if (Body != IntPtr.Zero)
@@ -3013,11 +3017,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3013 createAMotor(m_angularlocks); 3017 createAMotor(m_angularlocks);
3014 } 3018 }
3015 } 3019 }
3016 if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) 3020 if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body))
3017 { 3021 {
3018 _zeroFlag = true; 3022 _zeroFlag = true;
3019 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 3023 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
3020 d.BodyEnable(Body); 3024 SafeNativeMethods.BodyEnable(Body);
3021 } 3025 }
3022 } 3026 }
3023 } 3027 }
@@ -3027,12 +3031,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3027 { 3031 {
3028 if (newOri != _orientation) 3032 if (newOri != _orientation)
3029 { 3033 {
3030 d.Quaternion myrot = new d.Quaternion(); 3034 SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
3031 myrot.X = newOri.X; 3035 myrot.X = newOri.X;
3032 myrot.Y = newOri.Y; 3036 myrot.Y = newOri.Y;
3033 myrot.Z = newOri.Z; 3037 myrot.Z = newOri.Z;
3034 myrot.W = newOri.W; 3038 myrot.W = newOri.W;
3035 d.GeomSetQuaternion(prim_geom, ref myrot); 3039 SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot);
3036 _orientation = newOri; 3040 _orientation = newOri;
3037 } 3041 }
3038 } 3042 }
@@ -3057,26 +3061,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3057 { 3061 {
3058 if (newOri != _orientation) 3062 if (newOri != _orientation)
3059 { 3063 {
3060 d.Quaternion myrot = new d.Quaternion(); 3064 SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
3061 myrot.X = newOri.X; 3065 myrot.X = newOri.X;
3062 myrot.Y = newOri.Y; 3066 myrot.Y = newOri.Y;
3063 myrot.Z = newOri.Z; 3067 myrot.Z = newOri.Z;
3064 myrot.W = newOri.W; 3068 myrot.W = newOri.W;
3065 d.GeomSetQuaternion(prim_geom, ref myrot); 3069 SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot);
3066 _orientation = newOri; 3070 _orientation = newOri;
3067 if (Body != IntPtr.Zero && m_angularlocks != 0) 3071 if (Body != IntPtr.Zero && m_angularlocks != 0)
3068 createAMotor(m_angularlocks); 3072 createAMotor(m_angularlocks);
3069 } 3073 }
3070 if (_position != newPos) 3074 if (_position != newPos)
3071 { 3075 {
3072 d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); 3076 SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z);
3073 _position = newPos; 3077 _position = newPos;
3074 } 3078 }
3075 if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) 3079 if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body))
3076 { 3080 {
3077 _zeroFlag = true; 3081 _zeroFlag = true;
3078 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 3082 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
3079 d.BodyEnable(Body); 3083 SafeNativeMethods.BodyEnable(Body);
3080 } 3084 }
3081 } 3085 }
3082 } 3086 }
@@ -3089,21 +3093,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3089 { 3093 {
3090 if (newOri != _orientation) 3094 if (newOri != _orientation)
3091 { 3095 {
3092 d.Quaternion myrot = new d.Quaternion(); 3096 SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
3093 myrot.X = newOri.X; 3097 myrot.X = newOri.X;
3094 myrot.Y = newOri.Y; 3098 myrot.Y = newOri.Y;
3095 myrot.Z = newOri.Z; 3099 myrot.Z = newOri.Z;
3096 myrot.W = newOri.W; 3100 myrot.W = newOri.W;
3097 d.GeomSetQuaternion(prim_geom, ref myrot); 3101 SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot);
3098 _orientation = newOri; 3102 _orientation = newOri;
3099 } 3103 }
3100 3104
3101 if (newPos != _position) 3105 if (newPos != _position)
3102 { 3106 {
3103 d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); 3107 SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z);
3104 _position = newPos; 3108 _position = newPos;
3105 3109
3106 m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, _position, m_targetSpace); 3110 m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, m_targetSpace);
3107 } 3111 }
3108 } 3112 }
3109 } 3113 }
@@ -3184,13 +3188,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3184 3188
3185 if (prim_geom != IntPtr.Zero) 3189 if (prim_geom != IntPtr.Zero)
3186 { 3190 {
3187 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 3191 SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
3188 d.Quaternion myrot = new d.Quaternion(); 3192 SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
3189 myrot.X = _orientation.X; 3193 myrot.X = _orientation.X;
3190 myrot.Y = _orientation.Y; 3194 myrot.Y = _orientation.Y;
3191 myrot.Z = _orientation.Z; 3195 myrot.Z = _orientation.Z;
3192 myrot.W = _orientation.W; 3196 myrot.W = _orientation.W;
3193 d.GeomSetQuaternion(prim_geom, ref myrot); 3197 SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot);
3194 } 3198 }
3195 3199
3196 if (!m_isphysical) 3200 if (!m_isphysical)
@@ -3260,13 +3264,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3260 3264
3261 if (prim_geom != IntPtr.Zero) 3265 if (prim_geom != IntPtr.Zero)
3262 { 3266 {
3263 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 3267 SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
3264 d.Quaternion myrot = new d.Quaternion(); 3268 SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion();
3265 myrot.X = _orientation.X; 3269 myrot.X = _orientation.X;
3266 myrot.Y = _orientation.Y; 3270 myrot.Y = _orientation.Y;
3267 myrot.Z = _orientation.Z; 3271 myrot.Z = _orientation.Z;
3268 myrot.W = _orientation.W; 3272 myrot.W = _orientation.W;
3269 d.GeomSetQuaternion(prim_geom, ref myrot); 3273 SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot);
3270 } 3274 }
3271 3275
3272 if (m_isphysical) 3276 if (m_isphysical)
@@ -3317,10 +3321,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3317 { 3321 {
3318 if (m_disabled) 3322 if (m_disabled)
3319 enableBodySoft(); 3323 enableBodySoft();
3320 else if (!d.BodyIsEnabled(Body)) 3324 else if (!SafeNativeMethods.BodyIsEnabled(Body))
3321 { 3325 {
3322 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 3326 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
3323 d.BodyEnable(Body); 3327 SafeNativeMethods.BodyEnable(Body);
3324 } 3328 }
3325 } 3329 }
3326 m_torque = newtorque; 3330 m_torque = newtorque;
@@ -3330,10 +3334,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3330 private void changeForce(Vector3 force) 3334 private void changeForce(Vector3 force)
3331 { 3335 {
3332 m_force = force; 3336 m_force = force;
3333 if (!m_isSelected && !m_outbounds && Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) 3337 if (!m_isSelected && !m_outbounds && Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body))
3334 { 3338 {
3335 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 3339 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
3336 d.BodyEnable(Body); 3340 SafeNativeMethods.BodyEnable(Body);
3337 } 3341 }
3338 } 3342 }
3339 3343
@@ -3349,10 +3353,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3349 { 3353 {
3350 if (m_disabled) 3354 if (m_disabled)
3351 enableBodySoft(); 3355 enableBodySoft();
3352 else if (!d.BodyIsEnabled(Body)) 3356 else if (!SafeNativeMethods.BodyIsEnabled(Body))
3353 { 3357 {
3354 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 3358 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
3355 d.BodyEnable(Body); 3359 SafeNativeMethods.BodyEnable(Body);
3356 } 3360 }
3357 } 3361 }
3358 } 3362 }
@@ -3372,10 +3376,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3372 { 3376 {
3373 if (m_disabled) 3377 if (m_disabled)
3374 enableBodySoft(); 3378 enableBodySoft();
3375 else if (!d.BodyIsEnabled(Body)) 3379 else if (!SafeNativeMethods.BodyIsEnabled(Body))
3376 { 3380 {
3377 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 3381 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
3378 d.BodyEnable(Body); 3382 SafeNativeMethods.BodyEnable(Body);
3379 } 3383 }
3380 } 3384 }
3381 } 3385 }
@@ -3398,12 +3402,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3398 { 3402 {
3399 if (m_disabled) 3403 if (m_disabled)
3400 enableBodySoft(); 3404 enableBodySoft();
3401 else if (!d.BodyIsEnabled(Body)) 3405 else if (!SafeNativeMethods.BodyIsEnabled(Body))
3402 { 3406 {
3403 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 3407 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
3404 d.BodyEnable(Body); 3408 SafeNativeMethods.BodyEnable(Body);
3405 } 3409 }
3406 d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); 3410 SafeNativeMethods.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
3407 } 3411 }
3408 //resetCollisionAccounting(); 3412 //resetCollisionAccounting();
3409 } 3413 }
@@ -3425,12 +3429,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3425 { 3429 {
3426 if (m_disabled) 3430 if (m_disabled)
3427 enableBodySoft(); 3431 enableBodySoft();
3428 else if (!d.BodyIsEnabled(Body)) 3432 else if (!SafeNativeMethods.BodyIsEnabled(Body))
3429 { 3433 {
3430 d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); 3434 SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
3431 d.BodyEnable(Body); 3435 SafeNativeMethods.BodyEnable(Body);
3432 } 3436 }
3433 d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z); 3437 SafeNativeMethods.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z);
3434 } 3438 }
3435 //resetCollisionAccounting(); 3439 //resetCollisionAccounting();
3436 } 3440 }
@@ -3581,7 +3585,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3581 if (!childPrim && m_isphysical && Body != IntPtr.Zero && 3585 if (!childPrim && m_isphysical && Body != IntPtr.Zero &&
3582 !m_disabled && !m_isSelected && !m_building && !m_outbounds) 3586 !m_disabled && !m_isSelected && !m_building && !m_outbounds)
3583 { 3587 {
3584 if (!d.BodyIsEnabled(Body)) 3588 if (!SafeNativeMethods.BodyIsEnabled(Body))
3585 { 3589 {
3586 // let vehicles sleep 3590 // let vehicles sleep
3587 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) 3591 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
@@ -3591,18 +3595,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3591 return; 3595 return;
3592 3596
3593 // clear residuals 3597 // clear residuals
3594 d.BodySetAngularVel(Body,0f,0f,0f); 3598 SafeNativeMethods.BodySetAngularVel(Body,0f,0f,0f);
3595 d.BodySetLinearVel(Body,0f,0f,0f); 3599 SafeNativeMethods.BodySetLinearVel(Body,0f,0f,0f);
3596 _zeroFlag = true; 3600 _zeroFlag = true;
3597 d.BodySetAutoDisableSteps(Body, 1); 3601 SafeNativeMethods.BodySetAutoDisableSteps(Body, 1);
3598 d.BodyEnable(Body); 3602 SafeNativeMethods.BodyEnable(Body);
3599 m_bodydisablecontrol = -3; 3603 m_bodydisablecontrol = -3;
3600 } 3604 }
3601 3605
3602 if(m_bodydisablecontrol < 0) 3606 if(m_bodydisablecontrol < 0)
3603 m_bodydisablecontrol++; 3607 m_bodydisablecontrol++;
3604 3608
3605 d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator 3609 SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator
3606 3610
3607 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) 3611 if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
3608 { 3612 {
@@ -3629,8 +3633,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3629 3633
3630 if (_target_velocity.ApproxEquals(Vector3.Zero, 0.02f)) 3634 if (_target_velocity.ApproxEquals(Vector3.Zero, 0.02f))
3631 { 3635 {
3632 d.BodySetPosition(Body, m_PIDTarget.X, m_PIDTarget.Y, m_PIDTarget.Z); 3636 SafeNativeMethods.BodySetPosition(Body, m_PIDTarget.X, m_PIDTarget.Y, m_PIDTarget.Z);
3633 d.BodySetLinearVel(Body, 0, 0, 0); 3637 SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0);
3634 return; 3638 return;
3635 } 3639 }
3636 else 3640 else
@@ -3653,7 +3657,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3653 _target_velocity *= tmp; 3657 _target_velocity *= tmp;
3654 } 3658 }
3655 3659
3656 d.Vector3 vel = d.BodyGetLinearVel(Body); 3660 SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body);
3657 fx = (_target_velocity.X - vel.X) * m_invTimeStep; 3661 fx = (_target_velocity.X - vel.X) * m_invTimeStep;
3658 fy = (_target_velocity.Y - vel.Y) * m_invTimeStep; 3662 fy = (_target_velocity.Y - vel.Y) * m_invTimeStep;
3659 fz = (_target_velocity.Z - vel.Z) * m_invTimeStep; 3663 fz = (_target_velocity.Z - vel.Z) * m_invTimeStep;
@@ -3689,15 +3693,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3689 3693
3690 if (m_targetHoverHeight > m_groundHeight || m_isVolumeDetect) 3694 if (m_targetHoverHeight > m_groundHeight || m_isVolumeDetect)
3691 { 3695 {
3692 d.Vector3 vel = d.BodyGetLinearVel(Body); 3696 SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body);
3693 3697
3694 fz = (m_targetHoverHeight - lpos.Z); 3698 fz = (m_targetHoverHeight - lpos.Z);
3695 3699
3696 // if error is zero, use position control; otherwise, velocity control 3700 // if error is zero, use position control; otherwise, velocity control
3697 if (Math.Abs(fz) < 0.01f) 3701 if (Math.Abs(fz) < 0.01f)
3698 { 3702 {
3699 d.BodySetPosition(Body, lpos.X, lpos.Y, m_targetHoverHeight); 3703 SafeNativeMethods.BodySetPosition(Body, lpos.X, lpos.Y, m_targetHoverHeight);
3700 d.BodySetLinearVel(Body, vel.X, vel.Y, 0); 3704 SafeNativeMethods.BodySetLinearVel(Body, vel.X, vel.Y, 0);
3701 } 3705 }
3702 else 3706 else
3703 { 3707 {
@@ -3740,7 +3744,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3740 //m_log.Info("[OBJPID]: X:" + fx.ToString() + " Y:" + fy.ToString() + " Z:" + fz.ToString()); 3744 //m_log.Info("[OBJPID]: X:" + fx.ToString() + " Y:" + fy.ToString() + " Z:" + fz.ToString());
3741 if (fx != 0 || fy != 0 || fz != 0) 3745 if (fx != 0 || fy != 0 || fz != 0)
3742 { 3746 {
3743 d.BodyAddForce(Body, fx, fy, fz); 3747 SafeNativeMethods.BodyAddForce(Body, fx, fy, fz);
3744 //Console.WriteLine("AddForce " + fx + "," + fy + "," + fz); 3748 //Console.WriteLine("AddForce " + fx + "," + fy + "," + fz);
3745 } 3749 }
3746 3750
@@ -3751,7 +3755,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3751 m_angularForceacc = Vector3.Zero; 3755 m_angularForceacc = Vector3.Zero;
3752 if (trq.X != 0 || trq.Y != 0 || trq.Z != 0) 3756 if (trq.X != 0 || trq.Y != 0 || trq.Z != 0)
3753 { 3757 {
3754 d.BodyAddTorque(Body, trq.X, trq.Y, trq.Z); 3758 SafeNativeMethods.BodyAddTorque(Body, trq.X, trq.Y, trq.Z);
3755 } 3759 }
3756 } 3760 }
3757 else 3761 else
@@ -3770,12 +3774,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3770 if(m_bodydisablecontrol < 0) 3774 if(m_bodydisablecontrol < 0)
3771 return; 3775 return;
3772 3776
3773 bool bodyenabled = d.BodyIsEnabled(Body); 3777 bool bodyenabled = SafeNativeMethods.BodyIsEnabled(Body);
3774 if (bodyenabled || !_zeroFlag) 3778 if (bodyenabled || !_zeroFlag)
3775 { 3779 {
3776 bool lastZeroFlag = _zeroFlag; 3780 bool lastZeroFlag = _zeroFlag;
3777 3781
3778 d.Vector3 lpos = d.GeomGetPosition(prim_geom); 3782 SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(prim_geom);
3779 3783
3780 // check outside region 3784 // check outside region
3781 if (lpos.Z < -100 || lpos.Z > 100000f) 3785 if (lpos.Z < -100 || lpos.Z > 100000f)
@@ -3794,9 +3798,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3794 m_rotationalVelocity.Y = 0; 3798 m_rotationalVelocity.Y = 0;
3795 m_rotationalVelocity.Z = 0; 3799 m_rotationalVelocity.Z = 0;
3796 3800
3797 d.BodySetLinearVel(Body, 0, 0, 0); // stop it 3801 SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it
3798 d.BodySetAngularVel(Body, 0, 0, 0); // stop it 3802 SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0); // stop it
3799 d.BodySetPosition(Body, lpos.X, lpos.Y, lpos.Z); // put it somewhere 3803 SafeNativeMethods.BodySetPosition(Body, lpos.X, lpos.Y, lpos.Z); // put it somewhere
3800 m_lastposition = _position; 3804 m_lastposition = _position;
3801 m_lastorientation = _orientation; 3805 m_lastorientation = _orientation;
3802 3806
@@ -3836,19 +3840,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3836 m_lastposition = _position; 3840 m_lastposition = _position;
3837 m_lastorientation = _orientation; 3841 m_lastorientation = _orientation;
3838 3842
3839 d.Vector3 dtmp = d.BodyGetAngularVel(Body); 3843 SafeNativeMethods.Vector3 dtmp = SafeNativeMethods.BodyGetAngularVel(Body);
3840 m_rotationalVelocity.X = dtmp.X; 3844 m_rotationalVelocity.X = dtmp.X;
3841 m_rotationalVelocity.Y = dtmp.Y; 3845 m_rotationalVelocity.Y = dtmp.Y;
3842 m_rotationalVelocity.Z = dtmp.Z; 3846 m_rotationalVelocity.Z = dtmp.Z;
3843 3847
3844 dtmp = d.BodyGetLinearVel(Body); 3848 dtmp = SafeNativeMethods.BodyGetLinearVel(Body);
3845 _velocity.X = dtmp.X; 3849 _velocity.X = dtmp.X;
3846 _velocity.Y = dtmp.Y; 3850 _velocity.Y = dtmp.Y;
3847 _velocity.Z = dtmp.Z; 3851 _velocity.Z = dtmp.Z;
3848 3852
3849 d.BodySetLinearVel(Body, 0, 0, 0); // stop it 3853 SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it
3850 d.BodySetAngularVel(Body, 0, 0, 0); 3854 SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0);
3851 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 3855 SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
3852 disableBodySoft(); // stop collisions 3856 disableBodySoft(); // stop collisions
3853 UnSubscribeEvents(); 3857 UnSubscribeEvents();
3854 3858
@@ -3856,8 +3860,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3856 return; 3860 return;
3857 } 3861 }
3858 3862
3859 d.Quaternion ori; 3863 SafeNativeMethods.Quaternion ori;
3860 d.GeomCopyQuaternion(prim_geom, out ori); 3864 SafeNativeMethods.GeomCopyQuaternion(prim_geom, out ori);
3861 3865
3862 // decide if moving 3866 // decide if moving
3863 // use positions since this are integrated quantities 3867 // use positions since this are integrated quantities
@@ -3918,7 +3922,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3918 } 3922 }
3919 else 3923 else
3920 { 3924 {
3921 d.Vector3 vel = d.BodyGetLinearVel(Body); 3925 SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body);
3922 3926
3923 m_acceleration = _velocity; 3927 m_acceleration = _velocity;
3924 3928
@@ -3945,7 +3949,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3945 m_acceleration = Vector3.Zero; 3949 m_acceleration = Vector3.Zero;
3946 } 3950 }
3947 3951
3948 vel = d.BodyGetAngularVel(Body); 3952 vel = SafeNativeMethods.BodyGetAngularVel(Body);
3949 if ((Math.Abs(vel.X) < 0.0001) && 3953 if ((Math.Abs(vel.X) < 0.0001) &&
3950 (Math.Abs(vel.Y) < 0.0001) && 3954 (Math.Abs(vel.Y) < 0.0001) &&
3951 (Math.Abs(vel.Z) < 0.0001) 3955 (Math.Abs(vel.Z) < 0.0001)
@@ -3991,7 +3995,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
3991 return true; 3995 return true;
3992 } 3996 }
3993 3997
3994 internal static void DMassSubPartFromObj(ref d.Mass part, ref d.Mass theobj) 3998 internal static void DMassSubPartFromObj(ref SafeNativeMethods.Mass part, ref SafeNativeMethods.Mass theobj)
3995 { 3999 {
3996 // assumes object center of mass is zero 4000 // assumes object center of mass is zero
3997 float smass = part.mass; 4001 float smass = part.mass;
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs
index f671722..2e3a197 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs
@@ -29,10 +29,8 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Runtime.InteropServices; 31using System.Runtime.InteropServices;
32using System.Text;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.PhysicsModules.SharedBase; 33using OpenSim.Region.PhysicsModules.SharedBase;
35using OdeAPI;
36using log4net; 34using log4net;
37using OpenMetaverse; 35using OpenMetaverse;
38 36
@@ -67,7 +65,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
67 /// <summary> 65 /// <summary>
68 /// ODE near callback delegate 66 /// ODE near callback delegate
69 /// </summary> 67 /// </summary>
70 private d.NearCallback nearCallback; 68 private SafeNativeMethods.NearCallback nearCallback;
71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 69 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
72 private List<ContactResult> m_contactResults = new List<ContactResult>(); 70 private List<ContactResult> m_contactResults = new List<ContactResult>();
73 private RayFilterFlags CurrentRayFilter; 71 private RayFilterFlags CurrentRayFilter;
@@ -77,14 +75,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
77 { 75 {
78 m_scene = pScene; 76 m_scene = pScene;
79 nearCallback = near; 77 nearCallback = near;
80 ray = d.CreateRay(IntPtr.Zero, 1.0f); 78 ray = SafeNativeMethods.CreateRay(IntPtr.Zero, 1.0f);
81 d.GeomSetCategoryBits(ray, 0); 79 SafeNativeMethods.GeomSetCategoryBits(ray, 0);
82 Box = d.CreateBox(IntPtr.Zero, 1.0f, 1.0f, 1.0f); 80 Box = SafeNativeMethods.CreateBox(IntPtr.Zero, 1.0f, 1.0f, 1.0f);
83 d.GeomSetCategoryBits(Box, 0); 81 SafeNativeMethods.GeomSetCategoryBits(Box, 0);
84 Sphere = d.CreateSphere(IntPtr.Zero,1.0f); 82 Sphere = SafeNativeMethods.CreateSphere(IntPtr.Zero,1.0f);
85 d.GeomSetCategoryBits(Sphere, 0); 83 SafeNativeMethods.GeomSetCategoryBits(Sphere, 0);
86 Plane = d.CreatePlane(IntPtr.Zero, 0f,0f,1f,1f); 84 Plane = SafeNativeMethods.CreatePlane(IntPtr.Zero, 0f,0f,1f,1f);
87 d.GeomSetCategoryBits(Sphere, 0); 85 SafeNativeMethods.GeomSetCategoryBits(Sphere, 0);
88 } 86 }
89 87
90 public void QueueRequest(ODERayRequest req) 88 public void QueueRequest(ODERayRequest req)
@@ -152,29 +150,29 @@ namespace OpenSim.Region.PhysicsModule.ubOde
152 { 150 {
153 if (CollisionContactGeomsPerTest > 80) 151 if (CollisionContactGeomsPerTest > 80)
154 CollisionContactGeomsPerTest = 80; 152 CollisionContactGeomsPerTest = 80;
155 d.GeomBoxSetLengths(Box, req.Normal.X, req.Normal.Y, req.Normal.Z); 153 SafeNativeMethods.GeomBoxSetLengths(Box, req.Normal.X, req.Normal.Y, req.Normal.Z);
156 d.GeomSetPosition(Box, req.Origin.X, req.Origin.Y, req.Origin.Z); 154 SafeNativeMethods.GeomSetPosition(Box, req.Origin.X, req.Origin.Y, req.Origin.Z);
157 d.Quaternion qtmp; 155 SafeNativeMethods.Quaternion qtmp;
158 qtmp.X = req.orientation.X; 156 qtmp.X = req.orientation.X;
159 qtmp.Y = req.orientation.Y; 157 qtmp.Y = req.orientation.Y;
160 qtmp.Z = req.orientation.Z; 158 qtmp.Z = req.orientation.Z;
161 qtmp.W = req.orientation.W; 159 qtmp.W = req.orientation.W;
162 d.GeomSetQuaternion(Box, ref qtmp); 160 SafeNativeMethods.GeomSetQuaternion(Box, ref qtmp);
163 } 161 }
164 else if (req.callbackMethod is ProbeSphereCallback) 162 else if (req.callbackMethod is ProbeSphereCallback)
165 { 163 {
166 if (CollisionContactGeomsPerTest > 80) 164 if (CollisionContactGeomsPerTest > 80)
167 CollisionContactGeomsPerTest = 80; 165 CollisionContactGeomsPerTest = 80;
168 166
169 d.GeomSphereSetRadius(Sphere, req.length); 167 SafeNativeMethods.GeomSphereSetRadius(Sphere, req.length);
170 d.GeomSetPosition(Sphere, req.Origin.X, req.Origin.Y, req.Origin.Z); 168 SafeNativeMethods.GeomSetPosition(Sphere, req.Origin.X, req.Origin.Y, req.Origin.Z);
171 } 169 }
172 else if (req.callbackMethod is ProbePlaneCallback) 170 else if (req.callbackMethod is ProbePlaneCallback)
173 { 171 {
174 if (CollisionContactGeomsPerTest > 80) 172 if (CollisionContactGeomsPerTest > 80)
175 CollisionContactGeomsPerTest = 80; 173 CollisionContactGeomsPerTest = 80;
176 174
177 d.GeomPlaneSetParams(Plane, req.Normal.X, req.Normal.Y, req.Normal.Z, req.length); 175 SafeNativeMethods.GeomPlaneSetParams(Plane, req.Normal.X, req.Normal.Y, req.Normal.Z, req.length);
178 } 176 }
179 177
180 else 178 else
@@ -182,24 +180,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde
182 if (CollisionContactGeomsPerTest > 25) 180 if (CollisionContactGeomsPerTest > 25)
183 CollisionContactGeomsPerTest = 25; 181 CollisionContactGeomsPerTest = 25;
184 182
185 d.GeomRaySetLength(ray, req.length); 183 SafeNativeMethods.GeomRaySetLength(ray, req.length);
186 d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); 184 SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
187 d.GeomRaySetParams(ray, 0, backfacecull); 185 SafeNativeMethods.GeomRaySetParams(ray, 0, backfacecull);
188 186
189 if (req.callbackMethod is RaycastCallback) 187 if (req.callbackMethod is RaycastCallback)
190 { 188 {
191 // if we only want one get only one per Collision pair saving memory 189 // if we only want one get only one per Collision pair saving memory
192 CurrentRayFilter |= RayFilterFlags.ClosestHit; 190 CurrentRayFilter |= RayFilterFlags.ClosestHit;
193 d.GeomRaySetClosestHit(ray, 1); 191 SafeNativeMethods.GeomRaySetClosestHit(ray, 1);
194 } 192 }
195 else 193 else
196 d.GeomRaySetClosestHit(ray, closestHit); 194 SafeNativeMethods.GeomRaySetClosestHit(ray, closestHit);
197 } 195 }
198 196
199 if ((CurrentRayFilter & RayFilterFlags.ContactsUnImportant) != 0) 197 if ((CurrentRayFilter & RayFilterFlags.ContactsUnImportant) != 0)
200 unchecked 198 unchecked
201 { 199 {
202 CollisionContactGeomsPerTest |= (int)d.CONTACTS_UNIMPORTANT; 200 CollisionContactGeomsPerTest |= (int)SafeNativeMethods.CONTACTS_UNIMPORTANT;
203 } 201 }
204 202
205 if (geom == IntPtr.Zero) 203 if (geom == IntPtr.Zero)
@@ -224,27 +222,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde
224 if (req.callbackMethod is ProbeBoxCallback) 222 if (req.callbackMethod is ProbeBoxCallback)
225 { 223 {
226 catflags |= CollisionCategories.Space; 224 catflags |= CollisionCategories.Space;
227 d.GeomSetCollideBits(Box, (uint)catflags); 225 SafeNativeMethods.GeomSetCollideBits(Box, (uint)catflags);
228 d.GeomSetCategoryBits(Box, (uint)catflags); 226 SafeNativeMethods.GeomSetCategoryBits(Box, (uint)catflags);
229 doProbe(req, Box); 227 doProbe(req, Box);
230 } 228 }
231 else if (req.callbackMethod is ProbeSphereCallback) 229 else if (req.callbackMethod is ProbeSphereCallback)
232 { 230 {
233 catflags |= CollisionCategories.Space; 231 catflags |= CollisionCategories.Space;
234 d.GeomSetCollideBits(Sphere, (uint)catflags); 232 SafeNativeMethods.GeomSetCollideBits(Sphere, (uint)catflags);
235 d.GeomSetCategoryBits(Sphere, (uint)catflags); 233 SafeNativeMethods.GeomSetCategoryBits(Sphere, (uint)catflags);
236 doProbe(req, Sphere); 234 doProbe(req, Sphere);
237 } 235 }
238 else if (req.callbackMethod is ProbePlaneCallback) 236 else if (req.callbackMethod is ProbePlaneCallback)
239 { 237 {
240 catflags |= CollisionCategories.Space; 238 catflags |= CollisionCategories.Space;
241 d.GeomSetCollideBits(Plane, (uint)catflags); 239 SafeNativeMethods.GeomSetCollideBits(Plane, (uint)catflags);
242 d.GeomSetCategoryBits(Plane, (uint)catflags); 240 SafeNativeMethods.GeomSetCategoryBits(Plane, (uint)catflags);
243 doPlane(req,IntPtr.Zero); 241 doPlane(req,IntPtr.Zero);
244 } 242 }
245 else 243 else
246 { 244 {
247 d.GeomSetCollideBits(ray, (uint)catflags); 245 SafeNativeMethods.GeomSetCollideBits(ray, (uint)catflags);
248 doSpaceRay(req); 246 doSpaceRay(req);
249 } 247 }
250 } 248 }
@@ -255,12 +253,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
255 253
256 if (req.callbackMethod is ProbePlaneCallback) 254 if (req.callbackMethod is ProbePlaneCallback)
257 { 255 {
258 d.GeomSetCollideBits(Plane, (uint)CollisionCategories.All); 256 SafeNativeMethods.GeomSetCollideBits(Plane, (uint)CollisionCategories.All);
259 doPlane(req,geom); 257 doPlane(req,geom);
260 } 258 }
261 else 259 else
262 { 260 {
263 d.GeomSetCollideBits(ray, (uint)CollisionCategories.All); 261 SafeNativeMethods.GeomSetCollideBits(ray, (uint)CollisionCategories.All);
264 doGeomRay(req,geom); 262 doGeomRay(req,geom);
265 } 263 }
266 } 264 }
@@ -307,11 +305,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
307 // Collide tests 305 // Collide tests
308 if ((CurrentRayFilter & FilterActiveSpace) != 0) 306 if ((CurrentRayFilter & FilterActiveSpace) != 0)
309 { 307 {
310 d.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); 308 SafeNativeMethods.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback);
311 d.SpaceCollide2(ray, m_scene.CharsSpace, IntPtr.Zero, nearCallback); 309 SafeNativeMethods.SpaceCollide2(ray, m_scene.CharsSpace, IntPtr.Zero, nearCallback);
312 } 310 }
313 if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) 311 if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount))
314 d.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback); 312 SafeNativeMethods.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback);
315 if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) 313 if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount))
316 { 314 {
317 // current ode land to ray collisions is very bad 315 // current ode land to ray collisions is very bad
@@ -324,11 +322,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
324 { 322 {
325 float tmp2 = req.length * req.length - tmp + 2500; 323 float tmp2 = req.length * req.length - tmp + 2500;
326 tmp2 = (float)Math.Sqrt(tmp2); 324 tmp2 = (float)Math.Sqrt(tmp2);
327 d.GeomRaySetLength(ray, tmp2); 325 SafeNativeMethods.GeomRaySetLength(ray, tmp2);
328 } 326 }
329 327
330 } 328 }
331 d.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback); 329 SafeNativeMethods.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback);
332 } 330 }
333 331
334 if (req.callbackMethod is RaycastCallback) 332 if (req.callbackMethod is RaycastCallback)
@@ -377,13 +375,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
377 // Collide tests 375 // Collide tests
378 if ((CurrentRayFilter & FilterActiveSpace) != 0) 376 if ((CurrentRayFilter & FilterActiveSpace) != 0)
379 { 377 {
380 d.SpaceCollide2(probe, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); 378 SafeNativeMethods.SpaceCollide2(probe, m_scene.ActiveSpace, IntPtr.Zero, nearCallback);
381 d.SpaceCollide2(probe, m_scene.CharsSpace, IntPtr.Zero, nearCallback); 379 SafeNativeMethods.SpaceCollide2(probe, m_scene.CharsSpace, IntPtr.Zero, nearCallback);
382 } 380 }
383 if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) 381 if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount))
384 d.SpaceCollide2(probe, m_scene.StaticSpace, IntPtr.Zero, nearCallback); 382 SafeNativeMethods.SpaceCollide2(probe, m_scene.StaticSpace, IntPtr.Zero, nearCallback);
385 if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) 383 if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount))
386 d.SpaceCollide2(probe, m_scene.GroundSpace, IntPtr.Zero, nearCallback); 384 SafeNativeMethods.SpaceCollide2(probe, m_scene.GroundSpace, IntPtr.Zero, nearCallback);
387 385
388 List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count); 386 List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count);
389 lock (m_PendingRequests) 387 lock (m_PendingRequests)
@@ -404,17 +402,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
404 { 402 {
405 if ((CurrentRayFilter & FilterActiveSpace) != 0) 403 if ((CurrentRayFilter & FilterActiveSpace) != 0)
406 { 404 {
407 d.SpaceCollide2(Plane, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); 405 SafeNativeMethods.SpaceCollide2(Plane, m_scene.ActiveSpace, IntPtr.Zero, nearCallback);
408 d.SpaceCollide2(Plane, m_scene.CharsSpace, IntPtr.Zero, nearCallback); 406 SafeNativeMethods.SpaceCollide2(Plane, m_scene.CharsSpace, IntPtr.Zero, nearCallback);
409 } 407 }
410 if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) 408 if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount))
411 d.SpaceCollide2(Plane, m_scene.StaticSpace, IntPtr.Zero, nearCallback); 409 SafeNativeMethods.SpaceCollide2(Plane, m_scene.StaticSpace, IntPtr.Zero, nearCallback);
412 if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) 410 if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount))
413 d.SpaceCollide2(Plane, m_scene.GroundSpace, IntPtr.Zero, nearCallback); 411 SafeNativeMethods.SpaceCollide2(Plane, m_scene.GroundSpace, IntPtr.Zero, nearCallback);
414 } 412 }
415 else 413 else
416 { 414 {
417 d.SpaceCollide2(Plane, geom, IntPtr.Zero, nearCallback); 415 SafeNativeMethods.SpaceCollide2(Plane, geom, IntPtr.Zero, nearCallback);
418 } 416 }
419 417
420 List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count); 418 List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count);
@@ -434,7 +432,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
434 private void doGeomRay(ODERayRequest req, IntPtr geom) 432 private void doGeomRay(ODERayRequest req, IntPtr geom)
435 { 433 {
436 // Collide test 434 // Collide test
437 d.SpaceCollide2(ray, geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test 435 SafeNativeMethods.SpaceCollide2(ray, geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test
438 436
439 if (req.callbackMethod is RaycastCallback) 437 if (req.callbackMethod is RaycastCallback)
440 { 438 {
@@ -478,14 +476,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
478 } 476 }
479 } 477 }
480 478
481 private bool GetCurContactGeom(int index, ref d.ContactGeom newcontactgeom) 479 private bool GetCurContactGeom(int index, ref SafeNativeMethods.ContactGeom newcontactgeom)
482 { 480 {
483 IntPtr ContactgeomsArray = m_scene.ContactgeomsArray; 481 IntPtr ContactgeomsArray = m_scene.ContactgeomsArray;
484 if (ContactgeomsArray == IntPtr.Zero || index >= CollisionContactGeomsPerTest) 482 if (ContactgeomsArray == IntPtr.Zero || index >= CollisionContactGeomsPerTest)
485 return false; 483 return false;
486 484
487 IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * d.ContactGeom.unmanagedSizeOf)); 485 IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * SafeNativeMethods.ContactGeom.unmanagedSizeOf));
488 newcontactgeom = (d.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(d.ContactGeom)); 486 newcontactgeom = (SafeNativeMethods.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(SafeNativeMethods.ContactGeom));
489 return true; 487 return true;
490 } 488 }
491 489
@@ -498,11 +496,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
498 if (m_contactResults.Count >= CurrentMaxCount) 496 if (m_contactResults.Count >= CurrentMaxCount)
499 return; 497 return;
500 498
501 if (d.GeomIsSpace(g2)) 499 if (SafeNativeMethods.GeomIsSpace(g2))
502 { 500 {
503 try 501 try
504 { 502 {
505 d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); 503 SafeNativeMethods.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
506 } 504 }
507 catch (Exception e) 505 catch (Exception e)
508 { 506 {
@@ -514,7 +512,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
514 int count = 0; 512 int count = 0;
515 try 513 try
516 { 514 {
517 count = d.CollidePtr(g1, g2, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); 515 count = SafeNativeMethods.CollidePtr(g1, g2, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
518 } 516 }
519 catch (Exception e) 517 catch (Exception e)
520 { 518 {
@@ -586,7 +584,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
586 break; 584 break;
587 } 585 }
588 586
589 d.ContactGeom curcontact = new d.ContactGeom(); 587 SafeNativeMethods.ContactGeom curcontact = new SafeNativeMethods.ContactGeom();
590 588
591 // closestHit for now only works for meshs, so must do it for others 589 // closestHit for now only works for meshs, so must do it for others
592 if ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0) 590 if ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0)
@@ -654,22 +652,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde
654 m_scene = null; 652 m_scene = null;
655 if (ray != IntPtr.Zero) 653 if (ray != IntPtr.Zero)
656 { 654 {
657 d.GeomDestroy(ray); 655 SafeNativeMethods.GeomDestroy(ray);
658 ray = IntPtr.Zero; 656 ray = IntPtr.Zero;
659 } 657 }
660 if (Box != IntPtr.Zero) 658 if (Box != IntPtr.Zero)
661 { 659 {
662 d.GeomDestroy(Box); 660 SafeNativeMethods.GeomDestroy(Box);
663 Box = IntPtr.Zero; 661 Box = IntPtr.Zero;
664 } 662 }
665 if (Sphere != IntPtr.Zero) 663 if (Sphere != IntPtr.Zero)
666 { 664 {
667 d.GeomDestroy(Sphere); 665 SafeNativeMethods.GeomDestroy(Sphere);
668 Sphere = IntPtr.Zero; 666 Sphere = IntPtr.Zero;
669 } 667 }
670 if (Plane != IntPtr.Zero) 668 if (Plane != IntPtr.Zero)
671 { 669 {
672 d.GeomDestroy(Plane); 670 SafeNativeMethods.GeomDestroy(Plane);
673 Plane = IntPtr.Zero; 671 Plane = IntPtr.Zero;
674 } 672 }
675 } 673 }
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index 004ee7f..0003085 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -34,15 +34,10 @@ using System.Linq;
34using System.Reflection; 34using System.Reflection;
35using System.Runtime.InteropServices; 35using System.Runtime.InteropServices;
36using System.Threading; 36using System.Threading;
37using System.IO;
38using System.Diagnostics;
39using log4net; 37using log4net;
40using Nini.Config; 38using Nini.Config;
41using Mono.Addins;
42using OdeAPI;
43using OpenSim.Framework; 39using OpenSim.Framework;
44using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.PhysicsModules.SharedBase; 41using OpenSim.Region.PhysicsModules.SharedBase;
47using OpenMetaverse; 42using OpenMetaverse;
48 43
@@ -179,12 +174,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
179 174
180// const d.ContactFlags comumContactFlags = d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM |d.ContactFlags.Approx1 | d.ContactFlags.Bounce; 175// const d.ContactFlags comumContactFlags = d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM |d.ContactFlags.Approx1 | d.ContactFlags.Bounce;
181 176
182 const d.ContactFlags comumContactFlags = d.ContactFlags.Bounce | d.ContactFlags.Approx1 | d.ContactFlags.Slip1 | d.ContactFlags.Slip2; 177// const d.ContactFlags comumContactFlags = d.ContactFlags.Bounce | d.ContactFlags.Approx1 | d.ContactFlags.Slip1 | d.ContactFlags.Slip2;
178 const SafeNativeMethods.ContactFlags comumContactFlags = SafeNativeMethods.ContactFlags.Bounce | SafeNativeMethods.ContactFlags.Approx1;
183 const float comumContactERP = 0.75f; 179 const float comumContactERP = 0.75f;
184 const float comumContactCFM = 0.0001f; 180 const float comumContactCFM = 0.0001f;
185 const float comumContactSLIP = 0f; 181 const float comumContactSLIP = 0f;
186 182
187 float frictionMovementMult = 0.8f; 183// float frictionMovementMult = 0.2f;
188 184
189 float TerrainBounce = 0.001f; 185 float TerrainBounce = 0.001f;
190 float TerrainFriction = 0.3f; 186 float TerrainFriction = 0.3f;
@@ -200,7 +196,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
200 public float ODE_STEPSIZE = 0.020f; 196 public float ODE_STEPSIZE = 0.020f;
201 public float HalfOdeStep = 0.01f; 197 public float HalfOdeStep = 0.01f;
202 public int odetimestepMS = 20; // rounded 198 public int odetimestepMS = 20; // rounded
203 private float metersInSpace = 25.6f;
204 private float m_timeDilation = 1.0f; 199 private float m_timeDilation = 1.0f;
205 200
206 private double m_lastframe; 201 private double m_lastframe;
@@ -228,7 +223,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
228 223
229 public int bodyFramesAutoDisable = 5; 224 public int bodyFramesAutoDisable = 5;
230 225
231 private d.NearCallback nearCallback; 226 private SafeNativeMethods.NearCallback nearCallback;
232 227
233 private Dictionary<uint,OdePrim> _prims = new Dictionary<uint,OdePrim>(); 228 private Dictionary<uint,OdePrim> _prims = new Dictionary<uint,OdePrim>();
234 private HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>(); 229 private HashSet<OdeCharacter> _characters = new HashSet<OdeCharacter>();
@@ -251,7 +246,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
251 private int contactsPerCollision = 80; 246 private int contactsPerCollision = 80;
252 internal IntPtr ContactgeomsArray = IntPtr.Zero; 247 internal IntPtr ContactgeomsArray = IntPtr.Zero;
253 private IntPtr GlobalContactsArray = IntPtr.Zero; 248 private IntPtr GlobalContactsArray = IntPtr.Zero;
254 private d.Contact SharedTmpcontact = new d.Contact(); 249 private SafeNativeMethods.Contact SharedTmpcontact = new SafeNativeMethods.Contact();
255 250
256 const int maxContactsbeforedeath = 6000; 251 const int maxContactsbeforedeath = 6000;
257 private volatile int m_global_contactcount = 0; 252 private volatile int m_global_contactcount = 0;
@@ -283,16 +278,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
283 public IntPtr StaticSpace; // space for the static things around 278 public IntPtr StaticSpace; // space for the static things around
284 public IntPtr GroundSpace; // space for ground 279 public IntPtr GroundSpace; // space for ground
285 280
286 // some speedup variables
287 private int spaceGridMaxX;
288 private int spaceGridMaxY;
289 private float spacesPerMeterX;
290 private float spacesPerMeterY;
291
292 // split static geometry collision into a grid as before
293 private IntPtr[,] staticPrimspace;
294 private IntPtr[] staticPrimspaceOffRegion;
295
296 public Object OdeLock; 281 public Object OdeLock;
297 public static Object SimulationLock; 282 public static Object SimulationLock;
298 283
@@ -366,7 +351,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
366 /// </summary> 351 /// </summary>
367 private void Initialization() 352 private void Initialization()
368 { 353 {
369 d.AllocateODEDataForThread(~0U); 354 SafeNativeMethods.AllocateODEDataForThread(~0U);
370 355
371 SimulationLock = new Object(); 356 SimulationLock = new Object();
372 357
@@ -384,14 +369,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde
384 // Create the world and the first space 369 // Create the world and the first space
385 try 370 try
386 { 371 {
387 world = d.WorldCreate(); 372 world = SafeNativeMethods.WorldCreate();
388 TopSpace = d.HashSpaceCreate(IntPtr.Zero); 373 TopSpace = SafeNativeMethods.SimpleSpaceCreate(IntPtr.Zero);
389 374 ActiveSpace = SafeNativeMethods.SimpleSpaceCreate(TopSpace);
390 // now the major subspaces 375 CharsSpace = SafeNativeMethods.SimpleSpaceCreate(TopSpace);
391 ActiveSpace = d.HashSpaceCreate(TopSpace); 376 GroundSpace = SafeNativeMethods.SimpleSpaceCreate(TopSpace);
392 CharsSpace = d.HashSpaceCreate(TopSpace); 377 float sx = WorldExtents.X + 16;
393 StaticSpace = d.HashSpaceCreate(TopSpace); 378 float sy = WorldExtents.Y + 16;
394 GroundSpace = d.HashSpaceCreate(TopSpace); 379 SafeNativeMethods.Vector3 ex =new SafeNativeMethods.Vector3(sx, sy, 0);
380 SafeNativeMethods.Vector3 px =new SafeNativeMethods.Vector3(sx * 0.5f, sx * 0.5f, 0);
381 if(sx < sy)
382 sx = sy;
383 sx = (float)Math.Log(sx) * 1.442695f + 0.5f;
384 int dp = (int)sx - 2;
385 if(dp > 8)
386 dp = 8;
387 else if(dp < 4)
388 dp = 4;
389 StaticSpace = SafeNativeMethods.QuadTreeSpaceCreate(TopSpace, ref px, ref ex, dp);
395 } 390 }
396 catch 391 catch
397 { 392 {
@@ -399,54 +394,48 @@ namespace OpenSim.Region.PhysicsModule.ubOde
399 // i did! 394 // i did!
400 } 395 }
401 396
402 d.HashSpaceSetLevels(TopSpace, -5, 12);
403 d.HashSpaceSetLevels(ActiveSpace, -5, 10);
404 d.HashSpaceSetLevels(CharsSpace, -4, 3);
405 d.HashSpaceSetLevels(StaticSpace, -5, 12);
406 d.HashSpaceSetLevels(GroundSpace, 0, 8);
407
408 // demote to second level 397 // demote to second level
409 d.SpaceSetSublevel(ActiveSpace, 1); 398 SafeNativeMethods.SpaceSetSublevel(ActiveSpace, 1);
410 d.SpaceSetSublevel(CharsSpace, 1); 399 SafeNativeMethods.SpaceSetSublevel(CharsSpace, 1);
411 d.SpaceSetSublevel(StaticSpace, 1); 400 SafeNativeMethods.SpaceSetSublevel(StaticSpace, 1);
412 d.SpaceSetSublevel(GroundSpace, 1); 401 SafeNativeMethods.SpaceSetSublevel(GroundSpace, 1);
413 402
414 d.GeomSetCategoryBits(ActiveSpace, (uint)(CollisionCategories.Space | 403 SafeNativeMethods.GeomSetCategoryBits(ActiveSpace, (uint)(CollisionCategories.Space |
415 CollisionCategories.Geom | 404 CollisionCategories.Geom |
416 CollisionCategories.Character | 405 CollisionCategories.Character |
417 CollisionCategories.Phantom | 406 CollisionCategories.Phantom |
418 CollisionCategories.VolumeDtc 407 CollisionCategories.VolumeDtc
419 )); 408 ));
420 d.GeomSetCollideBits(ActiveSpace, (uint)(CollisionCategories.Space | 409 SafeNativeMethods.GeomSetCollideBits(ActiveSpace, (uint)(CollisionCategories.Space |
421 CollisionCategories.Geom | 410 CollisionCategories.Geom |
422 CollisionCategories.Character | 411 CollisionCategories.Character |
423 CollisionCategories.Phantom | 412 CollisionCategories.Phantom |
424 CollisionCategories.VolumeDtc 413 CollisionCategories.VolumeDtc
425 )); 414 ));
426 d.GeomSetCategoryBits(CharsSpace, (uint)(CollisionCategories.Space | 415 SafeNativeMethods.GeomSetCategoryBits(CharsSpace, (uint)(CollisionCategories.Space |
427 CollisionCategories.Geom | 416 CollisionCategories.Geom |
428 CollisionCategories.Character | 417 CollisionCategories.Character |
429 CollisionCategories.Phantom | 418 CollisionCategories.Phantom |
430 CollisionCategories.VolumeDtc 419 CollisionCategories.VolumeDtc
431 )); 420 ));
432 d.GeomSetCollideBits(CharsSpace, 0); 421 SafeNativeMethods.GeomSetCollideBits(CharsSpace, 0);
433 422
434 d.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space | 423 SafeNativeMethods.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space |
435 CollisionCategories.Geom | 424 CollisionCategories.Geom |
436 // CollisionCategories.Land | 425 // CollisionCategories.Land |
437 // CollisionCategories.Water | 426 // CollisionCategories.Water |
438 CollisionCategories.Phantom | 427 CollisionCategories.Phantom |
439 CollisionCategories.VolumeDtc 428 CollisionCategories.VolumeDtc
440 )); 429 ));
441 d.GeomSetCollideBits(StaticSpace, 0); 430 SafeNativeMethods.GeomSetCollideBits(StaticSpace, 0);
442 431
443 d.GeomSetCategoryBits(GroundSpace, (uint)(CollisionCategories.Land)); 432 SafeNativeMethods.GeomSetCategoryBits(GroundSpace, (uint)(CollisionCategories.Land));
444 d.GeomSetCollideBits(GroundSpace, 0); 433 SafeNativeMethods.GeomSetCollideBits(GroundSpace, 0);
445 434
446 contactgroup = d.JointGroupCreate(maxContactsbeforedeath + 1); 435 contactgroup = SafeNativeMethods.JointGroupCreate(maxContactsbeforedeath + 1);
447 //contactgroup 436 //contactgroup
448 437
449 d.WorldSetAutoDisableFlag(world, false); 438 SafeNativeMethods.WorldSetAutoDisableFlag(world, false);
450 } 439 }
451 440
452 441
@@ -468,8 +457,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
468 gravityy = physicsconfig.GetFloat("world_gravityy", gravityy); 457 gravityy = physicsconfig.GetFloat("world_gravityy", gravityy);
469 gravityz = physicsconfig.GetFloat("world_gravityz", gravityz); 458 gravityz = physicsconfig.GetFloat("world_gravityz", gravityz);
470 459
471 metersInSpace = physicsconfig.GetFloat("meters_in_small_space", metersInSpace);
472
473 // contactsurfacelayer = physicsconfig.GetFloat("world_contact_surface_layer", contactsurfacelayer); 460 // contactsurfacelayer = physicsconfig.GetFloat("world_contact_surface_layer", contactsurfacelayer);
474 461
475 ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE); 462 ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE);
@@ -498,27 +485,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde
498 maximumAngularVelocity = 0.49f * heartbeat *(float)Math.PI; 485 maximumAngularVelocity = 0.49f * heartbeat *(float)Math.PI;
499 maxAngVelocitySQ = maximumAngularVelocity * maximumAngularVelocity; 486 maxAngVelocitySQ = maximumAngularVelocity * maximumAngularVelocity;
500 487
501 d.WorldSetCFM(world, comumContactCFM); 488 SafeNativeMethods.WorldSetCFM(world, comumContactCFM);
502 d.WorldSetERP(world, comumContactERP); 489 SafeNativeMethods.WorldSetERP(world, comumContactERP);
503 490
504 d.WorldSetGravity(world, gravityx, gravityy, gravityz); 491 SafeNativeMethods.WorldSetGravity(world, gravityx, gravityy, gravityz);
505 492
506 d.WorldSetLinearDamping(world, 0.001f); 493 SafeNativeMethods.WorldSetLinearDamping(world, 0.001f);
507 d.WorldSetAngularDamping(world, 0.002f); 494 SafeNativeMethods.WorldSetAngularDamping(world, 0.002f);
508 d.WorldSetAngularDampingThreshold(world, 0f); 495 SafeNativeMethods.WorldSetAngularDampingThreshold(world, 0f);
509 d.WorldSetLinearDampingThreshold(world, 0f); 496 SafeNativeMethods.WorldSetLinearDampingThreshold(world, 0f);
510 d.WorldSetMaxAngularSpeed(world, maximumAngularVelocity); 497 SafeNativeMethods.WorldSetMaxAngularSpeed(world, maximumAngularVelocity);
511 498
512 d.WorldSetQuickStepNumIterations(world, m_physicsiterations); 499 SafeNativeMethods.WorldSetQuickStepNumIterations(world, m_physicsiterations);
513 500
514 d.WorldSetContactSurfaceLayer(world, contactsurfacelayer); 501 SafeNativeMethods.WorldSetContactSurfaceLayer(world, contactsurfacelayer);
515 d.WorldSetContactMaxCorrectingVel(world, 60.0f); 502 SafeNativeMethods.WorldSetContactMaxCorrectingVel(world, 60.0f);
516 503
517 HalfOdeStep = ODE_STEPSIZE * 0.5f; 504 HalfOdeStep = ODE_STEPSIZE * 0.5f;
518 odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f); 505 odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f);
519 506
520 ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * d.ContactGeom.unmanagedSizeOf); 507 ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * SafeNativeMethods.ContactGeom.unmanagedSizeOf);
521 GlobalContactsArray = Marshal.AllocHGlobal((maxContactsbeforedeath + 100) * d.Contact.unmanagedSizeOf); 508 GlobalContactsArray = Marshal.AllocHGlobal((maxContactsbeforedeath + 100) * SafeNativeMethods.Contact.unmanagedSizeOf);
522 509
523 SharedTmpcontact.geom.g1 = IntPtr.Zero; 510 SharedTmpcontact.geom.g1 = IntPtr.Zero;
524 SharedTmpcontact.geom.g2 = IntPtr.Zero; 511 SharedTmpcontact.geom.g2 = IntPtr.Zero;
@@ -559,76 +546,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
559 m_materialContactsData[(int)Material.light].mu = 0.0f; 546 m_materialContactsData[(int)Material.light].mu = 0.0f;
560 m_materialContactsData[(int)Material.light].bounce = 0.0f; 547 m_materialContactsData[(int)Material.light].bounce = 0.0f;
561 548
562
563 spacesPerMeterX = 1.0f / metersInSpace;
564 spacesPerMeterY = spacesPerMeterX;
565 spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeterX);
566 spaceGridMaxY = (int)(WorldExtents.Y * spacesPerMeterY);
567
568 if (spaceGridMaxX > 24)
569 {
570 spaceGridMaxX = 24;
571 spacesPerMeterX = spaceGridMaxX / WorldExtents.X;
572 }
573
574 if (spaceGridMaxY > 24)
575 {
576 spaceGridMaxY = 24;
577 spacesPerMeterY = spaceGridMaxY / WorldExtents.Y;
578 }
579
580 staticPrimspace = new IntPtr[spaceGridMaxX, spaceGridMaxY];
581
582 // create all spaces now
583 int i, j;
584 IntPtr newspace;
585
586 for (i = 0; i < spaceGridMaxX; i++)
587 for (j = 0; j < spaceGridMaxY; j++)
588 {
589 newspace = d.HashSpaceCreate(StaticSpace);
590 d.GeomSetCategoryBits(newspace, (int)CollisionCategories.Space);
591 waitForSpaceUnlock(newspace);
592 d.SpaceSetSublevel(newspace, 2);
593 d.HashSpaceSetLevels(newspace, -2, 8);
594 d.GeomSetCategoryBits(newspace, (uint)(CollisionCategories.Space |
595 CollisionCategories.Geom |
596 CollisionCategories.Land |
597 CollisionCategories.Water |
598 CollisionCategories.Phantom |
599 CollisionCategories.VolumeDtc
600 ));
601 d.GeomSetCollideBits(newspace, 0);
602
603 staticPrimspace[i, j] = newspace;
604 }
605
606 // let this now be index limit
607 spaceGridMaxX--;
608 spaceGridMaxY--;
609
610 // create 4 off world spaces (x<0,x>max,y<0,y>max)
611 staticPrimspaceOffRegion = new IntPtr[4];
612
613 for (i = 0; i < 4; i++)
614 {
615 newspace = d.HashSpaceCreate(StaticSpace);
616 d.GeomSetCategoryBits(newspace, (int)CollisionCategories.Space);
617 waitForSpaceUnlock(newspace);
618 d.SpaceSetSublevel(newspace, 2);
619 d.HashSpaceSetLevels(newspace, -2, 8);
620 d.GeomSetCategoryBits(newspace, (uint)(CollisionCategories.Space |
621 CollisionCategories.Geom |
622 CollisionCategories.Land |
623 CollisionCategories.Water |
624 CollisionCategories.Phantom |
625 CollisionCategories.VolumeDtc
626 ));
627 d.GeomSetCollideBits(newspace, 0);
628
629 staticPrimspaceOffRegion[i] = newspace;
630 }
631
632 m_lastframe = Util.GetTimeStamp(); 549 m_lastframe = Util.GetTimeStamp();
633 m_lastMeshExpire = m_lastframe; 550 m_lastMeshExpire = m_lastframe;
634 step_time = -1; 551 step_time = -1;
@@ -643,7 +560,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
643 #region Collision Detection 560 #region Collision Detection
644 561
645 // sets a global contact for a joint for contactgeom , and base contact description) 562 // sets a global contact for a joint for contactgeom , and base contact description)
646 private IntPtr CreateContacJoint(ref d.ContactGeom contactGeom,bool smooth) 563 private IntPtr CreateContacJoint(ref SafeNativeMethods.ContactGeom contactGeom,bool smooth)
647 { 564 {
648 if (m_global_contactcount >= maxContactsbeforedeath) 565 if (m_global_contactcount >= maxContactsbeforedeath)
649 return IntPtr.Zero; 566 return IntPtr.Zero;
@@ -656,18 +573,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
656 SharedTmpcontact.geom.pos = contactGeom.pos; 573 SharedTmpcontact.geom.pos = contactGeom.pos;
657 SharedTmpcontact.geom.normal = contactGeom.normal; 574 SharedTmpcontact.geom.normal = contactGeom.normal;
658 575
659 IntPtr contact = new IntPtr(GlobalContactsArray.ToInt64() + (Int64)(m_global_contactcount * d.Contact.unmanagedSizeOf)); 576 IntPtr contact = new IntPtr(GlobalContactsArray.ToInt64() + (Int64)(m_global_contactcount * SafeNativeMethods.Contact.unmanagedSizeOf));
660 Marshal.StructureToPtr(SharedTmpcontact, contact, true); 577 Marshal.StructureToPtr(SharedTmpcontact, contact, true);
661 return d.JointCreateContactPtr(world, contactgroup, contact); 578 return SafeNativeMethods.JointCreateContactPtr(world, contactgroup, contact);
662 } 579 }
663 580
664 private bool GetCurContactGeom(int index, ref d.ContactGeom newcontactgeom) 581 private bool GetCurContactGeom(int index, ref SafeNativeMethods.ContactGeom newcontactgeom)
665 { 582 {
666 if (ContactgeomsArray == IntPtr.Zero || index >= contactsPerCollision) 583 if (ContactgeomsArray == IntPtr.Zero || index >= contactsPerCollision)
667 return false; 584 return false;
668 585
669 IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * d.ContactGeom.unmanagedSizeOf)); 586 IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * SafeNativeMethods.ContactGeom.unmanagedSizeOf));
670 newcontactgeom = (d.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(d.ContactGeom)); 587 newcontactgeom = (SafeNativeMethods.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(SafeNativeMethods.ContactGeom));
671 return true; 588 return true;
672 } 589 }
673 590
@@ -692,14 +609,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
692 if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) 609 if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
693 return; 610 return;
694 611
695 if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) 612 if (SafeNativeMethods.GeomIsSpace(g1) || SafeNativeMethods.GeomIsSpace(g2))
696 { 613 {
697 // We'll be calling near recursivly if one 614 // We'll be calling near recursivly if one
698 // of them is a space to find all of the 615 // of them is a space to find all of the
699 // contact points in the space 616 // contact points in the space
700 try 617 try
701 { 618 {
702 d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); 619 SafeNativeMethods.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
703 } 620 }
704 catch (AccessViolationException) 621 catch (AccessViolationException)
705 { 622 {
@@ -714,8 +631,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
714 631
715 // get geom bodies to check if we already a joint contact 632 // get geom bodies to check if we already a joint contact
716 // guess this shouldn't happen now 633 // guess this shouldn't happen now
717 IntPtr b1 = d.GeomGetBody(g1); 634 IntPtr b1 = SafeNativeMethods.GeomGetBody(g1);
718 IntPtr b2 = d.GeomGetBody(g2); 635 IntPtr b2 = SafeNativeMethods.GeomGetBody(g2);
719 636
720 // d.GeomClassID id = d.GeomGetClass(g1); 637 // d.GeomClassID id = d.GeomGetClass(g1);
721 638
@@ -757,19 +674,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
757 // 674 //
758 */ 675 */
759 676
760 677 if (SafeNativeMethods.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc ||
761 if (d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc || 678 SafeNativeMethods.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc)
762 d.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc)
763 { 679 {
764 int cflags; 680 int cflags;
765 unchecked 681 unchecked
766 { 682 {
767 cflags = (int)(1 | d.CONTACTS_UNIMPORTANT); 683 cflags = (int)(1 | SafeNativeMethods.CONTACTS_UNIMPORTANT);
768 } 684 }
769 count = d.CollidePtr(g1, g2, cflags, ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); 685 count = SafeNativeMethods.CollidePtr(g1, g2, cflags, ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
770 } 686 }
771 else 687 else
772 count = d.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); 688 count = SafeNativeMethods.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
773 } 689 }
774 catch (SEHException) 690 catch (SEHException)
775 { 691 {
@@ -805,7 +721,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
805 721
806 722
807 // get first contact 723 // get first contact
808 d.ContactGeom curContact = new d.ContactGeom(); 724 SafeNativeMethods.ContactGeom curContact = new SafeNativeMethods.ContactGeom();
809 725
810 if (!GetCurContactGeom(0, ref curContact)) 726 if (!GetCurContactGeom(0, ref curContact))
811 return; 727 return;
@@ -866,9 +782,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
866 break; 782 break;
867 783
868 case (int)ActorTypes.Prim: 784 case (int)ActorTypes.Prim:
869 Vector3 relV = p1.rootVelocity - p2.rootVelocity; 785// Vector3 relV = p1.rootVelocity - p2.rootVelocity;
870 float relVlenSQ = relV.LengthSquared(); 786// float relVlenSQ = relV.LengthSquared();
871 if (relVlenSQ > 0.0001f) 787// if (relVlenSQ > 0.0001f)
872 { 788 {
873 p1.CollidingObj = true; 789 p1.CollidingObj = true;
874 p2.CollidingObj = true; 790 p2.CollidingObj = true;
@@ -878,11 +794,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
878 bounce = contactdata1.bounce * contactdata2.bounce; 794 bounce = contactdata1.bounce * contactdata2.bounce;
879 mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); 795 mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu);
880 796
881 if (relVlenSQ > 0.01f) 797// if (relVlenSQ > 0.01f)
882 mu *= frictionMovementMult; 798// mu *= frictionMovementMult;
883 799
884 if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass && 800 if(SafeNativeMethods.GeomGetClass(g2) == SafeNativeMethods.GeomClassID.TriMeshClass &&
885 d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) 801 SafeNativeMethods.GeomGetClass(g1) == SafeNativeMethods.GeomClassID.TriMeshClass)
886 smoothMesh = true; 802 smoothMesh = true;
887 break; 803 break;
888 804
@@ -891,12 +807,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
891 bounce = contactdata1.bounce * TerrainBounce; 807 bounce = contactdata1.bounce * TerrainBounce;
892 mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); 808 mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction);
893 809
894 Vector3 v1 = p1.rootVelocity; 810// Vector3 v1 = p1.rootVelocity;
895 if (Math.Abs(v1.X) > 0.1f || Math.Abs(v1.Y) > 0.1f) 811// if (Math.Abs(v1.X) > 0.1f || Math.Abs(v1.Y) > 0.1f)
896 mu *= frictionMovementMult; 812// mu *= frictionMovementMult;
897 p1.CollidingGround = true; 813 p1.CollidingGround = true;
898 814
899 if(d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) 815 if(SafeNativeMethods.GeomGetClass(g1) == SafeNativeMethods.GeomClassID.TriMeshClass)
900 smoothMesh = true; 816 smoothMesh = true;
901 break; 817 break;
902 818
@@ -918,11 +834,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
918 834
919// if (curContact.side1 > 0) // should be 2 ? 835// if (curContact.side1 > 0) // should be 2 ?
920// IgnoreNegSides = true; 836// IgnoreNegSides = true;
921 Vector3 v2 = p2.rootVelocity; 837// Vector3 v2 = p2.rootVelocity;
922 if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f) 838// if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f)
923 mu *= frictionMovementMult; 839// mu *= frictionMovementMult;
924 840
925 if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass) 841 if(SafeNativeMethods.GeomGetClass(g2) == SafeNativeMethods.GeomClassID.TriMeshClass)
926 smoothMesh = true; 842 smoothMesh = true;
927 } 843 }
928 else 844 else
@@ -952,7 +868,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
952 SharedTmpcontact.surface.mu = mu; 868 SharedTmpcontact.surface.mu = mu;
953 SharedTmpcontact.surface.bounce = bounce; 869 SharedTmpcontact.surface.bounce = bounce;
954 870
955 d.ContactGeom altContact = new d.ContactGeom(); 871 SafeNativeMethods.ContactGeom altContact = new SafeNativeMethods.ContactGeom();
956 bool useAltcontact; 872 bool useAltcontact;
957 bool noskip; 873 bool noskip;
958 874
@@ -1004,7 +920,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1004 if (Joint == IntPtr.Zero) 920 if (Joint == IntPtr.Zero)
1005 break; 921 break;
1006 922
1007 d.JointAttach(Joint, b1, b2); 923 SafeNativeMethods.JointAttach(Joint, b1, b2);
1008 924
1009 ncontacts++; 925 ncontacts++;
1010 926
@@ -1152,12 +1068,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1152 continue; 1068 continue;
1153 1069
1154 // do colisions with static space 1070 // do colisions with static space
1155 d.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, nearCallback); 1071 SafeNativeMethods.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, nearCallback);
1156 1072
1157 // no coll with gnd 1073 // no coll with gnd
1158 } 1074 }
1159 // chars with chars 1075 // chars with chars
1160 d.SpaceCollide(CharsSpace, IntPtr.Zero, nearCallback); 1076 SafeNativeMethods.SpaceCollide(CharsSpace, IntPtr.Zero, nearCallback);
1161 1077
1162 } 1078 }
1163 catch (AccessViolationException) 1079 catch (AccessViolationException)
@@ -1173,7 +1089,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1173 { 1089 {
1174 aprim.CollisionScore = 0; 1090 aprim.CollisionScore = 0;
1175 aprim.IsColliding = false; 1091 aprim.IsColliding = false;
1176 if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body)) 1092 if(!aprim.m_outbounds && SafeNativeMethods.BodyIsEnabled(aprim.Body))
1177 aprim.clearSleeperCollisions(); 1093 aprim.clearSleeperCollisions();
1178 } 1094 }
1179 } 1095 }
@@ -1184,11 +1100,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1184 { 1100 {
1185 foreach (OdePrim aprim in _activegroups) 1101 foreach (OdePrim aprim in _activegroups)
1186 { 1102 {
1187 if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body) && 1103 if(!aprim.m_outbounds && SafeNativeMethods.BodyIsEnabled(aprim.Body) &&
1188 aprim.collide_geom != IntPtr.Zero) 1104 aprim.collide_geom != IntPtr.Zero)
1189 { 1105 {
1190 d.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); 1106 SafeNativeMethods.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback);
1191 d.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); 1107 SafeNativeMethods.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback);
1192 } 1108 }
1193 } 1109 }
1194 } 1110 }
@@ -1201,7 +1117,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1201 // colide active amoung them 1117 // colide active amoung them
1202 try 1118 try
1203 { 1119 {
1204 d.SpaceCollide(ActiveSpace, IntPtr.Zero, nearCallback); 1120 SafeNativeMethods.SpaceCollide(ActiveSpace, IntPtr.Zero, nearCallback);
1205 } 1121 }
1206 catch (Exception e) 1122 catch (Exception e)
1207 { 1123 {
@@ -1211,7 +1127,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1211 // and with chars 1127 // and with chars
1212 try 1128 try
1213 { 1129 {
1214 d.SpaceCollide2(CharsSpace,ActiveSpace, IntPtr.Zero, nearCallback); 1130 SafeNativeMethods.SpaceCollide2(CharsSpace,ActiveSpace, IntPtr.Zero, nearCallback);
1215 } 1131 }
1216 catch (Exception e) 1132 catch (Exception e)
1217 { 1133 {
@@ -1306,9 +1222,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1306 public override void RemoveAvatar(PhysicsActor actor) 1222 public override void RemoveAvatar(PhysicsActor actor)
1307 { 1223 {
1308 //m_log.Debug("[PHYSICS]:ODELOCK"); 1224 //m_log.Debug("[PHYSICS]:ODELOCK");
1225 if (world == IntPtr.Zero)
1226 return;
1227
1309 lock (OdeLock) 1228 lock (OdeLock)
1310 { 1229 {
1311 d.AllocateODEDataForThread(0); 1230 SafeNativeMethods.AllocateODEDataForThread(0);
1312 ((OdeCharacter) actor).Destroy(); 1231 ((OdeCharacter) actor).Destroy();
1313 } 1232 }
1314 } 1233 }
@@ -1460,39 +1379,35 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1460 1379
1461 /// <summary> 1380 /// <summary>
1462 /// Called when a static prim moves or becomes static 1381 /// Called when a static prim moves or becomes static
1463 /// Places the prim in a space one the static sub-spaces grid 1382 /// Places the prim in a space one the static space
1464 /// </summary> 1383 /// </summary>
1465 /// <param name="geom">the pointer to the geom that moved</param> 1384 /// <param name="geom">the pointer to the geom that moved</param>
1466 /// <param name="pos">the position that the geom moved to</param>
1467 /// <param name="currentspace">a pointer to the space it was in before it was moved.</param> 1385 /// <param name="currentspace">a pointer to the space it was in before it was moved.</param>
1468 /// <returns>a pointer to the new space it's in</returns> 1386 /// <returns>a pointer to the new space it's in</returns>
1469 public IntPtr MoveGeomToStaticSpace(IntPtr geom, Vector3 pos, IntPtr currentspace) 1387 public IntPtr MoveGeomToStaticSpace(IntPtr geom, IntPtr currentspace)
1470 { 1388 {
1471 // moves a prim into another static sub-space or from another space into a static sub-space 1389 // moves a prim into static sub-space
1472 1390
1473 // Called ODEPrim so 1391 // Called ODEPrim so
1474 // it's already in locked space. 1392 // it's already in locked space.
1475 1393
1476 if (geom == IntPtr.Zero) // shouldn't happen 1394 if (geom == IntPtr.Zero) // shouldn't happen
1477 return IntPtr.Zero; 1395 return IntPtr.Zero;
1478 1396
1479 // get the static sub-space for current position 1397 if (StaticSpace == currentspace) // if we are there all done
1480 IntPtr newspace = calculateSpaceForGeom(pos); 1398 return StaticSpace;
1481
1482 if (newspace == currentspace) // if we are there all done
1483 return newspace;
1484 1399
1485 // else remove it from its current space 1400 // else remove it from its current space
1486 if (currentspace != IntPtr.Zero && d.SpaceQuery(currentspace, geom)) 1401 if (currentspace != IntPtr.Zero && SafeNativeMethods.SpaceQuery(currentspace, geom))
1487 { 1402 {
1488 if (d.GeomIsSpace(currentspace)) 1403 if (SafeNativeMethods.GeomIsSpace(currentspace))
1489 { 1404 {
1490 waitForSpaceUnlock(currentspace); 1405 waitForSpaceUnlock(currentspace);
1491 d.SpaceRemove(currentspace, geom); 1406 SafeNativeMethods.SpaceRemove(currentspace, geom);
1492 1407
1493 if (d.SpaceGetSublevel(currentspace) > 2 && d.SpaceGetNumGeoms(currentspace) == 0) 1408 if (SafeNativeMethods.SpaceGetSublevel(currentspace) > 2 && SafeNativeMethods.SpaceGetNumGeoms(currentspace) == 0)
1494 { 1409 {
1495 d.SpaceDestroy(currentspace); 1410 SafeNativeMethods.SpaceDestroy(currentspace);
1496 } 1411 }
1497 } 1412 }
1498 else 1413 else
@@ -1501,59 +1416,33 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1501 " Geom:" + geom); 1416 " Geom:" + geom);
1502 } 1417 }
1503 } 1418 }
1504 else // odd currentspace is null or doesn't contain the geom? lets try the geom ideia of current space 1419 else
1505 { 1420 {
1506 currentspace = d.GeomGetSpace(geom); 1421 currentspace = SafeNativeMethods.GeomGetSpace(geom);
1507 if (currentspace != IntPtr.Zero) 1422 if (currentspace != IntPtr.Zero)
1508 { 1423 {
1509 if (d.GeomIsSpace(currentspace)) 1424 if (SafeNativeMethods.GeomIsSpace(currentspace))
1510 { 1425 {
1511 waitForSpaceUnlock(currentspace); 1426 waitForSpaceUnlock(currentspace);
1512 d.SpaceRemove(currentspace, geom); 1427 SafeNativeMethods.SpaceRemove(currentspace, geom);
1513 1428
1514 if (d.SpaceGetSublevel(currentspace) > 2 && d.SpaceGetNumGeoms(currentspace) == 0) 1429 if (SafeNativeMethods.SpaceGetSublevel(currentspace) > 2 && SafeNativeMethods.SpaceGetNumGeoms(currentspace) == 0)
1515 { 1430 {
1516 d.SpaceDestroy(currentspace); 1431 SafeNativeMethods.SpaceDestroy(currentspace);
1517 } 1432 }
1518
1519 } 1433 }
1520 } 1434 }
1521 } 1435 }
1522 1436
1523 // put the geom in the newspace 1437 // put the geom in the newspace
1524 waitForSpaceUnlock(newspace); 1438 waitForSpaceUnlock(StaticSpace);
1525 d.SpaceAdd(newspace, geom); 1439 if(SafeNativeMethods.SpaceQuery(StaticSpace, geom))
1526 1440 m_log.Info("[Physics]: 'MoveGeomToStaticSpace' geom already in static space:" + geom);
1527 // let caller know this newspace 1441 else
1528 return newspace; 1442 SafeNativeMethods.SpaceAdd(StaticSpace, geom);
1529 }
1530
1531 /// <summary>
1532 /// Calculates the space the prim should be in by its position
1533 /// </summary>
1534 /// <param name="pos"></param>
1535 /// <returns>a pointer to the space. This could be a new space or reused space.</returns>
1536 public IntPtr calculateSpaceForGeom(Vector3 pos)
1537 {
1538 int x, y;
1539
1540 if (pos.X < 0)
1541 return staticPrimspaceOffRegion[0];
1542
1543 if (pos.Y < 0)
1544 return staticPrimspaceOffRegion[2];
1545
1546 x = (int)(pos.X * spacesPerMeterX);
1547 if (x > spaceGridMaxX)
1548 return staticPrimspaceOffRegion[1];
1549
1550 y = (int)(pos.Y * spacesPerMeterY);
1551 if (y > spaceGridMaxY)
1552 return staticPrimspaceOffRegion[3];
1553 1443
1554 return staticPrimspace[x, y]; 1444 return StaticSpace;
1555 } 1445 }
1556
1557 #endregion 1446 #endregion
1558 1447
1559 1448
@@ -1592,7 +1481,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1592 return; 1481 return;
1593 } 1482 }
1594 1483
1595 d.AllocateODEDataForThread(~0U); 1484 SafeNativeMethods.AllocateODEDataForThread(~0U);
1596 1485
1597 ODEchangeitem item; 1486 ODEchangeitem item;
1598 1487
@@ -1641,6 +1530,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1641 /// <returns></returns> 1530 /// <returns></returns>
1642 public override float Simulate(float reqTimeStep) 1531 public override float Simulate(float reqTimeStep)
1643 { 1532 {
1533 if (world == IntPtr.Zero)
1534 return 0;
1535
1644 double now = Util.GetTimeStamp(); 1536 double now = Util.GetTimeStamp();
1645 double timeStep = now - m_lastframe; 1537 double timeStep = now - m_lastframe;
1646 m_lastframe = now; 1538 m_lastframe = now;
@@ -1679,11 +1571,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1679 double maxChangestime = (int)(reqTimeStep * 500f); // half the time 1571 double maxChangestime = (int)(reqTimeStep * 500f); // half the time
1680 double maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time 1572 double maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time
1681 1573
1682// double collisionTime = 0; 1574/*
1683// double qstepTIme = 0; 1575 double collisionTime = 0;
1684// double tmpTime = 0; 1576 double qstepTIme = 0;
1685 1577 double tmpTime = 0;
1686 d.AllocateODEDataForThread(~0U); 1578 double changestot = 0;
1579 double collisonRepo = 0;
1580 double updatesTime = 0;
1581 double moveTime = 0;
1582 double rayTime = 0;
1583*/
1584 SafeNativeMethods.AllocateODEDataForThread(~0U);
1687 1585
1688 if (ChangesQueue.Count > 0) 1586 if (ChangesQueue.Count > 0)
1689 { 1587 {
@@ -1719,6 +1617,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1719 m_global_contactcount = 0; 1617 m_global_contactcount = 0;
1720 1618
1721 1619
1620// tmpTime = Util.GetTimeStampMS();
1621
1722 // Move characters 1622 // Move characters
1723 lock (_characters) 1623 lock (_characters)
1724 { 1624 {
@@ -1746,13 +1646,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1746 aprim.Move(); 1646 aprim.Move();
1747 } 1647 }
1748 } 1648 }
1649// moveTime += Util.GetTimeStampMS() - tmpTime;
1749 1650
1651// tmpTime = Util.GetTimeStampMS();
1750 m_rayCastManager.ProcessQueuedRequests(); 1652 m_rayCastManager.ProcessQueuedRequests();
1653// rayTime += Util.GetTimeStampMS() - tmpTime;
1751 1654
1752// tmpTime = Util.GetTimeStampMS(); 1655// tmpTime = Util.GetTimeStampMS();
1753 collision_optimized(); 1656 collision_optimized();
1754// collisionTime += Util.GetTimeStampMS() - tmpTime; 1657// collisionTime += Util.GetTimeStampMS() - tmpTime;
1755 1658
1659// tmpTime = Util.GetTimeStampMS();
1756 lock(_collisionEventPrimRemove) 1660 lock(_collisionEventPrimRemove)
1757 { 1661 {
1758 foreach (PhysicsActor obj in _collisionEventPrimRemove) 1662 foreach (PhysicsActor obj in _collisionEventPrimRemove)
@@ -1781,7 +1685,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1781 pobj.SendCollisions((int)(odetimestepMS)); 1685 pobj.SendCollisions((int)(odetimestepMS));
1782 if(pobj.Body != IntPtr.Zero && !pobj.m_isSelected && 1686 if(pobj.Body != IntPtr.Zero && !pobj.m_isSelected &&
1783 !pobj.m_disabled && !pobj.m_building && 1687 !pobj.m_disabled && !pobj.m_building &&
1784 !d.BodyIsEnabled(pobj.Body)) 1688 !SafeNativeMethods.BodyIsEnabled(pobj.Body))
1785 sleepers.Add(pobj); 1689 sleepers.Add(pobj);
1786 } 1690 }
1787 break; 1691 break;
@@ -1791,11 +1695,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1791 foreach(OdePrim prm in sleepers) 1695 foreach(OdePrim prm in sleepers)
1792 prm.SleeperAddCollisionEvents(); 1696 prm.SleeperAddCollisionEvents();
1793 sleepers.Clear(); 1697 sleepers.Clear();
1698// collisonRepo += Util.GetTimeStampMS() - tmpTime;
1699
1794 1700
1795 // do a ode simulation step 1701 // do a ode simulation step
1796// tmpTime = Util.GetTimeStampMS(); 1702// tmpTime = Util.GetTimeStampMS();
1797 d.WorldQuickStep(world, ODE_STEPSIZE); 1703 SafeNativeMethods.WorldQuickStep(world, ODE_STEPSIZE);
1798 d.JointGroupEmpty(contactgroup); 1704 SafeNativeMethods.JointGroupEmpty(contactgroup);
1799// qstepTIme += Util.GetTimeStampMS() - tmpTime; 1705// qstepTIme += Util.GetTimeStampMS() - tmpTime;
1800 1706
1801 // update managed ideia of physical data and do updates to core 1707 // update managed ideia of physical data and do updates to core
@@ -1814,7 +1720,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1814 } 1720 }
1815 } 1721 }
1816 */ 1722 */
1817 1723// tmpTime = Util.GetTimeStampMS();
1818 lock (_activegroups) 1724 lock (_activegroups)
1819 { 1725 {
1820 { 1726 {
@@ -1827,6 +1733,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1827 } 1733 }
1828 } 1734 }
1829 } 1735 }
1736// updatesTime += Util.GetTimeStampMS() - tmpTime;
1830 } 1737 }
1831 catch (Exception e) 1738 catch (Exception e)
1832 { 1739 {
@@ -1834,10 +1741,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1834// ode.dunlock(world); 1741// ode.dunlock(world);
1835 } 1742 }
1836 1743
1744
1837 step_time -= ODE_STEPSIZE; 1745 step_time -= ODE_STEPSIZE;
1838 nodeframes++; 1746 nodeframes++;
1839 1747
1840 looptimeMS = Util.GetTimeStampMS() - loopstartMS; 1748 looptimeMS = Util.GetTimeStampMS() - loopstartMS;
1749
1841 if (looptimeMS > maxLoopTime) 1750 if (looptimeMS > maxLoopTime)
1842 break; 1751 break;
1843 } 1752 }
@@ -1854,9 +1763,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1854 _badCharacter.Clear(); 1763 _badCharacter.Clear();
1855 } 1764 }
1856 } 1765 }
1857
1858// information block for in debug breakpoint only
1859/* 1766/*
1767// information block for in debug breakpoint only
1768
1860 int ntopactivegeoms = d.SpaceGetNumGeoms(ActiveSpace); 1769 int ntopactivegeoms = d.SpaceGetNumGeoms(ActiveSpace);
1861 int ntopstaticgeoms = d.SpaceGetNumGeoms(StaticSpace); 1770 int ntopstaticgeoms = d.SpaceGetNumGeoms(StaticSpace);
1862 int ngroundgeoms = d.SpaceGetNumGeoms(GroundSpace); 1771 int ngroundgeoms = d.SpaceGetNumGeoms(GroundSpace);
@@ -1898,33 +1807,23 @@ namespace OpenSim.Region.PhysicsModule.ubOde
1898 int nbodies = d.NTotalBodies; 1807 int nbodies = d.NTotalBodies;
1899 int ngeoms = d.NTotalGeoms; 1808 int ngeoms = d.NTotalGeoms;
1900*/ 1809*/
1810
1901/* 1811/*
1902 looptimeMS /= nodeframes; 1812 looptimeMS /= nodeframes;
1903 if(looptimeMS > 0.080) 1813 collisionTime /= nodeframes;
1904 { 1814 qstepTIme /= nodeframes;
1905 collisionTime /= nodeframes; 1815 changestot /= nodeframes;
1906 qstepTIme /= nodeframes; 1816 collisonRepo /= nodeframes;
1907 } 1817 updatesTime /= nodeframes;
1908*/ 1818 moveTime /= nodeframes;
1909 // Finished with all sim stepping. If requested, dump world state to file for debugging. 1819 rayTime /= nodeframes;
1910 // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed? 1820
1911 // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots? 1821 if(looptimeMS > .05)
1912 if (physics_logging && (physics_logging_interval > 0) && (framecount % physics_logging_interval == 0))
1913 { 1822 {
1914 string fname = "state-" + world.ToString() + ".DIF"; // give each physics world a separate filename
1915 string prefix = "world" + world.ToString(); // prefix for variable names in exported .DIF file
1916 1823
1917 if (physics_logging_append_existing_logfile)
1918 {
1919 string header = "-------------- START OF PHYSICS FRAME " + framecount.ToString() + " --------------";
1920 TextWriter fwriter = File.AppendText(fname);
1921 fwriter.WriteLine(header);
1922 fwriter.Close();
1923 }
1924 1824
1925 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
1926 } 1825 }
1927 1826*/
1928 fps = (float)nodeframes * ODE_STEPSIZE / reqTimeStep; 1827 fps = (float)nodeframes * ODE_STEPSIZE / reqTimeStep;
1929 1828
1930 if(step_time < HalfOdeStep) 1829 if(step_time < HalfOdeStep)
@@ -2285,35 +2184,35 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2285 2184
2286 lock (OdeLock) 2185 lock (OdeLock)
2287 { 2186 {
2288 d.AllocateODEDataForThread(~0U); 2187 SafeNativeMethods.AllocateODEDataForThread(~0U);
2289 2188
2290 if (TerrainGeom != IntPtr.Zero) 2189 if (TerrainGeom != IntPtr.Zero)
2291 { 2190 {
2292 actor_name_map.Remove(TerrainGeom); 2191 actor_name_map.Remove(TerrainGeom);
2293 d.GeomDestroy(TerrainGeom); 2192 SafeNativeMethods.GeomDestroy(TerrainGeom);
2294 2193
2295 } 2194 }
2296 2195
2297 if (TerrainHeightFieldHeightsHandler.IsAllocated) 2196 if (TerrainHeightFieldHeightsHandler.IsAllocated)
2298 TerrainHeightFieldHeightsHandler.Free(); 2197 TerrainHeightFieldHeightsHandler.Free();
2299 2198
2300 IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); 2199 IntPtr HeightmapData = SafeNativeMethods.GeomHeightfieldDataCreate();
2301 2200
2302 TerrainHeightFieldHeightsHandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned); 2201 TerrainHeightFieldHeightsHandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned);
2303 2202
2304 d.GeomHeightfieldDataBuildSingle(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0, 2203 SafeNativeMethods.GeomHeightfieldDataBuildSingle(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0,
2305 heightmapHeight, heightmapWidth , 2204 heightmapHeight, heightmapWidth ,
2306 (int)heightmapHeightSamples, (int)heightmapWidthSamples, scale, 2205 (int)heightmapHeightSamples, (int)heightmapWidthSamples, scale,
2307 offset, thickness, wrap); 2206 offset, thickness, wrap);
2308 2207
2309 d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); 2208 SafeNativeMethods.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
2310 2209
2311 TerrainGeom = d.CreateHeightfield(GroundSpace, HeightmapData, 1); 2210 TerrainGeom = SafeNativeMethods.CreateHeightfield(GroundSpace, HeightmapData, 1);
2312 2211
2313 if (TerrainGeom != IntPtr.Zero) 2212 if (TerrainGeom != IntPtr.Zero)
2314 { 2213 {
2315 d.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land)); 2214 SafeNativeMethods.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land));
2316 d.GeomSetCollideBits(TerrainGeom, 0); 2215 SafeNativeMethods.GeomSetCollideBits(TerrainGeom, 0);
2317 2216
2318 PhysicsActor pa = new NullPhysicsActor(); 2217 PhysicsActor pa = new NullPhysicsActor();
2319 pa.Name = "Terrain"; 2218 pa.Name = "Terrain";
@@ -2322,14 +2221,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2322 2221
2323// geom_name_map[GroundGeom] = "Terrain"; 2222// geom_name_map[GroundGeom] = "Terrain";
2324 2223
2325 d.Quaternion q = new d.Quaternion(); 2224 SafeNativeMethods.Quaternion q = new SafeNativeMethods.Quaternion();
2326 q.X = 0.5f; 2225 q.X = 0.5f;
2327 q.Y = 0.5f; 2226 q.Y = 0.5f;
2328 q.Z = 0.5f; 2227 q.Z = 0.5f;
2329 q.W = 0.5f; 2228 q.W = 0.5f;
2330 2229
2331 d.GeomSetQuaternion(TerrainGeom, ref q); 2230 SafeNativeMethods.GeomSetQuaternion(TerrainGeom, ref q);
2332 d.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f); 2231 SafeNativeMethods.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f);
2333 TerrainHeightFieldHeight = _heightmap; 2232 TerrainHeightFieldHeight = _heightmap;
2334 } 2233 }
2335 else 2234 else
@@ -2397,7 +2296,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2397 if (TerrainGeom != IntPtr.Zero) 2296 if (TerrainGeom != IntPtr.Zero)
2398 { 2297 {
2399 actor_name_map.Remove(TerrainGeom); 2298 actor_name_map.Remove(TerrainGeom);
2400 d.GeomDestroy(TerrainGeom); 2299 SafeNativeMethods.GeomDestroy(TerrainGeom);
2401 } 2300 }
2402 2301
2403 if (TerrainHeightFieldHeightsHandler.IsAllocated) 2302 if (TerrainHeightFieldHeightsHandler.IsAllocated)
@@ -2405,7 +2304,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2405 2304
2406 TerrainHeightFieldHeight = null; 2305 TerrainHeightFieldHeight = null;
2407 2306
2408 IntPtr HeightmapData = d.GeomOSTerrainDataCreate(); 2307 IntPtr HeightmapData = SafeNativeMethods.GeomOSTerrainDataCreate();
2409 2308
2410 const int wrap = 0; 2309 const int wrap = 0;
2411 float thickness = hfmin; 2310 float thickness = hfmin;
@@ -2414,16 +2313,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2414 2313
2415 TerrainHeightFieldHeightsHandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned); 2314 TerrainHeightFieldHeightsHandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned);
2416 2315
2417 d.GeomOSTerrainDataBuild(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0, 1.0f, 2316 SafeNativeMethods.GeomOSTerrainDataBuild(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0, 1.0f,
2418 (int)heightmapWidthSamples, (int)heightmapHeightSamples, 2317 (int)heightmapWidthSamples, (int)heightmapHeightSamples,
2419 thickness, wrap); 2318 thickness, wrap);
2420 2319
2421// d.GeomOSTerrainDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); 2320// d.GeomOSTerrainDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
2422 TerrainGeom = d.CreateOSTerrain(GroundSpace, HeightmapData, 1); 2321 TerrainGeom = SafeNativeMethods.CreateOSTerrain(GroundSpace, HeightmapData, 1);
2423 if (TerrainGeom != IntPtr.Zero) 2322 if (TerrainGeom != IntPtr.Zero)
2424 { 2323 {
2425 d.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land)); 2324 SafeNativeMethods.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land));
2426 d.GeomSetCollideBits(TerrainGeom, 0); 2325 SafeNativeMethods.GeomSetCollideBits(TerrainGeom, 0);
2427 2326
2428 PhysicsActor pa = new NullPhysicsActor(); 2327 PhysicsActor pa = new NullPhysicsActor();
2429 pa.Name = "Terrain"; 2328 pa.Name = "Terrain";
@@ -2432,7 +2331,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2432 2331
2433// geom_name_map[GroundGeom] = "Terrain"; 2332// geom_name_map[GroundGeom] = "Terrain";
2434 2333
2435 d.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f); 2334 SafeNativeMethods.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f);
2436 TerrainHeightFieldHeight = _heightmap; 2335 TerrainHeightFieldHeight = _heightmap;
2437 } 2336 }
2438 else 2337 else
@@ -2462,7 +2361,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2462 if (world == IntPtr.Zero) 2361 if (world == IntPtr.Zero)
2463 return; 2362 return;
2464 2363
2465 d.AllocateODEDataForThread(~0U); 2364 SafeNativeMethods.AllocateODEDataForThread(~0U);
2466 2365
2467 if (m_meshWorker != null) 2366 if (m_meshWorker != null)
2468 m_meshWorker.Stop(); 2367 m_meshWorker.Stop();
@@ -2496,7 +2395,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2496 ch.DoAChange(changes.Remove, null); 2395 ch.DoAChange(changes.Remove, null);
2497 2396
2498 if (TerrainGeom != IntPtr.Zero) 2397 if (TerrainGeom != IntPtr.Zero)
2499 d.GeomDestroy(TerrainGeom); 2398 SafeNativeMethods.GeomDestroy(TerrainGeom);
2500 TerrainGeom = IntPtr.Zero; 2399 TerrainGeom = IntPtr.Zero;
2501 2400
2502 if (TerrainHeightFieldHeightsHandler.IsAllocated) 2401 if (TerrainHeightFieldHeightsHandler.IsAllocated)
@@ -2515,7 +2414,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
2515 GlobalContactsArray = IntPtr.Zero; 2414 GlobalContactsArray = IntPtr.Zero;
2516 } 2415 }
2517 2416
2518 d.WorldDestroy(world); 2417 SafeNativeMethods.WorldDestroy(world);
2519 world = IntPtr.Zero; 2418 world = IntPtr.Zero;
2520 //d.CloseODE(); 2419 //d.CloseODE();
2521 } 2420 }
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs b/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs
index 214205d..f882e6c 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs
@@ -27,13 +27,7 @@
27// Ubit Umarov 2012 27// Ubit Umarov 2012
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
31using System.Runtime.InteropServices;
32using System.Text;
33using OpenSim.Framework;
34using OpenSim.Region.PhysicsModules.SharedBase; 30using OpenSim.Region.PhysicsModules.SharedBase;
35using OdeAPI;
36using log4net;
37using OpenMetaverse; 31using OpenMetaverse;
38 32
39namespace OpenSim.Region.PhysicsModule.ubOde 33namespace OpenSim.Region.PhysicsModule.ubOde
@@ -78,8 +72,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
78 72
79 IntPtr geom = ((OdePrim)actor).prim_geom; 73 IntPtr geom = ((OdePrim)actor).prim_geom;
80 74
81 Vector3 geopos = d.GeomGetPositionOMV(geom); 75 Vector3 geopos = SafeNativeMethods.GeomGetPositionOMV(geom);
82 Quaternion geomOri = d.GeomGetQuaternionOMV(geom); 76 Quaternion geomOri = SafeNativeMethods.GeomGetQuaternionOMV(geom);
83 77
84// Vector3 geopos = actor.Position; 78// Vector3 geopos = actor.Position;
85// Quaternion geomOri = actor.Orientation; 79// Quaternion geomOri = actor.Orientation;
@@ -123,11 +117,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
123 117
124 offset = rayResults[0].Pos - geopos; 118 offset = rayResults[0].Pos - geopos;
125 119
126 d.GeomClassID geoclass = d.GeomGetClass(geom); 120 SafeNativeMethods.GeomClassID geoclass = SafeNativeMethods.GeomGetClass(geom);
127 121
128 if (geoclass == d.GeomClassID.SphereClass) 122 if (geoclass == SafeNativeMethods.GeomClassID.SphereClass)
129 { 123 {
130 float r = d.GeomSphereGetRadius(geom); 124 float r = SafeNativeMethods.GeomSphereGetRadius(geom);
131 125
132 offset.Normalize(); 126 offset.Normalize();
133 offset *= r; 127 offset *= r;