diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/PhysicsModules/Ode | |
parent | Add a build script. (diff) | |
download | opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/PhysicsModules/Ode')
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEApi.cs | 2025 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEModule.cs | 89 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | 720 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs | 97 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 980 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/drawstuff.cs | 98 |
11 files changed, 2644 insertions, 1431 deletions
diff --git a/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs index 7869739..3691d96 100644 --- a/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs | |||
@@ -56,7 +56,7 @@ using Mono.Addins; | |||
56 | // You can specify all values by your own or you can build default build and revision | 56 | // You can specify all values by your own or you can build default build and revision |
57 | // numbers with the '*' character (the default): | 57 | // numbers with the '*' character (the default): |
58 | 58 | ||
59 | [assembly : AssemblyVersion("0.8.2.*")] | 59 | [assembly : AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)] |
60 | 60 | ||
61 | [assembly: Addin("OpenSim.Region.PhysicsModule.ODE", OpenSim.VersionInfo.VersionNumber)] | 61 | [assembly: Addin("OpenSim.Region.PhysicsModule.ODE", OpenSim.VersionInfo.VersionNumber)] |
62 | [assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] | 62 | [assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] |
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEApi.cs b/OpenSim/Region/PhysicsModules/Ode/ODEApi.cs new file mode 100644 index 0000000..c851b12 --- /dev/null +++ b/OpenSim/Region/PhysicsModules/Ode/ODEApi.cs | |||
@@ -0,0 +1,2025 @@ | |||
1 | /* | ||
2 | * based on: | ||
3 | * Ode.NET - .NET bindings for ODE | ||
4 | * Jason Perkins (starkos@industriousone.com) | ||
5 | * Licensed under the New BSD | ||
6 | * Part of the OpenDynamicsEngine | ||
7 | Open Dynamics Engine | ||
8 | Copyright (c) 2001-2007, Russell L. Smith. | ||
9 | All rights reserved. | ||
10 | |||
11 | Redistribution and use in source and binary forms, with or without | ||
12 | modification, are permitted provided that the following conditions | ||
13 | are met: | ||
14 | |||
15 | Redistributions of source code must retain the above copyright notice, | ||
16 | this list of conditions and the following disclaimer. | ||
17 | |||
18 | Redistributions in binary form must reproduce the above copyright notice, | ||
19 | this list of conditions and the following disclaimer in the documentation | ||
20 | and/or other materials provided with the distribution. | ||
21 | |||
22 | Neither the names of ODE's copyright owner nor the names of its | ||
23 | contributors may be used to endorse or promote products derived from | ||
24 | this software without specific prior written permission. | ||
25 | |||
26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
29 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
32 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
33 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
34 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
35 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
37 | * | ||
38 | * changes by opensim team; | ||
39 | * changes by Aurora team http://www.aurora-sim.org/ | ||
40 | * changes by Ubit Umarov | ||
41 | */ | ||
42 | |||
43 | using System; | ||
44 | using System.Runtime.InteropServices; | ||
45 | using System.Security; | ||
46 | using OMV = OpenMetaverse; | ||
47 | |||
48 | namespace OpenSim.Region.PhysicsModule.ODE | ||
49 | { | ||
50 | //#if dDOUBLE | ||
51 | // don't see much use in double precision with time steps of 20ms and 10 iterations used on opensim | ||
52 | // at least we save same memory and memory access time, FPU performance on intel usually is similar | ||
53 | // using dReal = System.Double; | ||
54 | //#else | ||
55 | using dReal = System.Single; | ||
56 | //#endif | ||
57 | |||
58 | public static class d | ||
59 | { | ||
60 | public static dReal Infinity = dReal.MaxValue; | ||
61 | public static int NTotalBodies = 0; | ||
62 | public static int NTotalGeoms = 0; | ||
63 | |||
64 | public const uint CONTACTS_UNIMPORTANT = 0x80000000; | ||
65 | |||
66 | #region Flags and Enumerations | ||
67 | |||
68 | [Flags] | ||
69 | public enum AllocateODEDataFlags : uint | ||
70 | { | ||
71 | BasicData = 0, | ||
72 | CollisionData = 0x00000001, | ||
73 | All = ~0u | ||
74 | } | ||
75 | |||
76 | [Flags] | ||
77 | public enum IniteODEFlags : uint | ||
78 | { | ||
79 | dInitFlagManualThreadCleanup = 0x00000001 | ||
80 | } | ||
81 | |||
82 | [Flags] | ||
83 | public enum ContactFlags : int | ||
84 | { | ||
85 | Mu2 = 0x001, | ||
86 | FDir1 = 0x002, | ||
87 | Bounce = 0x004, | ||
88 | SoftERP = 0x008, | ||
89 | SoftCFM = 0x010, | ||
90 | Motion1 = 0x020, | ||
91 | Motion2 = 0x040, | ||
92 | MotionN = 0x080, | ||
93 | Slip1 = 0x100, | ||
94 | Slip2 = 0x200, | ||
95 | Approx0 = 0x0000, | ||
96 | Approx1_1 = 0x1000, | ||
97 | Approx1_2 = 0x2000, | ||
98 | Approx1 = 0x3000 | ||
99 | } | ||
100 | |||
101 | public enum GeomClassID : int | ||
102 | { | ||
103 | SphereClass, | ||
104 | BoxClass, | ||
105 | CapsuleClass, | ||
106 | CylinderClass, | ||
107 | PlaneClass, | ||
108 | RayClass, | ||
109 | ConvexClass, | ||
110 | GeomTransformClass, | ||
111 | TriMeshClass, | ||
112 | HeightfieldClass, | ||
113 | FirstSpaceClass, | ||
114 | SimpleSpaceClass = FirstSpaceClass, | ||
115 | HashSpaceClass, | ||
116 | QuadTreeSpaceClass, | ||
117 | LastSpaceClass = QuadTreeSpaceClass, | ||
118 | ubtTerrainClass, | ||
119 | FirstUserClass, | ||
120 | LastUserClass = FirstUserClass + MaxUserClasses - 1, | ||
121 | NumClasses, | ||
122 | MaxUserClasses = 5 | ||
123 | } | ||
124 | |||
125 | public enum JointType : int | ||
126 | { | ||
127 | None, | ||
128 | Ball, | ||
129 | Hinge, | ||
130 | Slider, | ||
131 | Contact, | ||
132 | Universal, | ||
133 | Hinge2, | ||
134 | Fixed, | ||
135 | Null, | ||
136 | AMotor, | ||
137 | LMotor, | ||
138 | Plane2D | ||
139 | } | ||
140 | |||
141 | public enum JointParam : int | ||
142 | { | ||
143 | LoStop, | ||
144 | HiStop, | ||
145 | Vel, | ||
146 | FMax, | ||
147 | FudgeFactor, | ||
148 | Bounce, | ||
149 | CFM, | ||
150 | StopERP, | ||
151 | StopCFM, | ||
152 | SuspensionERP, | ||
153 | SuspensionCFM, | ||
154 | LoStop2 = 256, | ||
155 | HiStop2, | ||
156 | Vel2, | ||
157 | FMax2, | ||
158 | FudgeFactor2, | ||
159 | Bounce2, | ||
160 | CFM2, | ||
161 | StopERP2, | ||
162 | StopCFM2, | ||
163 | SuspensionERP2, | ||
164 | SuspensionCFM2, | ||
165 | LoStop3 = 512, | ||
166 | HiStop3, | ||
167 | Vel3, | ||
168 | FMax3, | ||
169 | FudgeFactor3, | ||
170 | Bounce3, | ||
171 | CFM3, | ||
172 | StopERP3, | ||
173 | StopCFM3, | ||
174 | SuspensionERP3, | ||
175 | SuspensionCFM3 | ||
176 | } | ||
177 | |||
178 | public enum dSweepAndPruneAxis : int | ||
179 | { | ||
180 | XYZ = ((0)|(1<<2)|(2<<4)), | ||
181 | XZY = ((0)|(2<<2)|(1<<4)), | ||
182 | YXZ = ((1)|(0<<2)|(2<<4)), | ||
183 | YZX = ((1)|(2<<2)|(0<<4)), | ||
184 | ZXY = ((2)|(0<<2)|(1<<4)), | ||
185 | ZYX = ((2)|(1<<2)|(0<<4)) | ||
186 | } | ||
187 | |||
188 | #endregion | ||
189 | |||
190 | #region Callbacks | ||
191 | |||
192 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
193 | public delegate int AABBTestFn(IntPtr o1, IntPtr o2, ref AABB aabb); | ||
194 | |||
195 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
196 | public delegate int ColliderFn(IntPtr o1, IntPtr o2, int flags, out ContactGeom contact, int skip); | ||
197 | |||
198 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
199 | public delegate void GetAABBFn(IntPtr geom, out AABB aabb); | ||
200 | |||
201 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
202 | public delegate ColliderFn GetColliderFnFn(int num); | ||
203 | |||
204 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
205 | public delegate void GeomDtorFn(IntPtr o); | ||
206 | |||
207 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
208 | public delegate dReal HeightfieldGetHeight(IntPtr p_user_data, int x, int z); | ||
209 | |||
210 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
211 | public delegate dReal OSTerrainGetHeight(IntPtr p_user_data, int x, int z); | ||
212 | |||
213 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
214 | public delegate void NearCallback(IntPtr data, IntPtr geom1, IntPtr geom2); | ||
215 | |||
216 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
217 | public delegate int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex); | ||
218 | |||
219 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
220 | public delegate int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount); | ||
221 | |||
222 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
223 | public delegate int TriRayCallback(IntPtr trimesh, IntPtr ray, int triangleIndex, dReal u, dReal v); | ||
224 | |||
225 | #endregion | ||
226 | |||
227 | #region Structs | ||
228 | |||
229 | [StructLayout(LayoutKind.Sequential)] | ||
230 | public struct AABB | ||
231 | { | ||
232 | public dReal MinX, MaxX; | ||
233 | public dReal MinY, MaxY; | ||
234 | public dReal MinZ, MaxZ; | ||
235 | } | ||
236 | |||
237 | |||
238 | [StructLayout(LayoutKind.Sequential)] | ||
239 | public struct Contact | ||
240 | { | ||
241 | public SurfaceParameters surface; | ||
242 | public ContactGeom geom; | ||
243 | public Vector3 fdir1; | ||
244 | public static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(Contact)); | ||
245 | } | ||
246 | |||
247 | |||
248 | [StructLayout(LayoutKind.Sequential)] | ||
249 | public struct ContactGeom | ||
250 | { | ||
251 | |||
252 | public Vector3 pos; | ||
253 | public Vector3 normal; | ||
254 | public dReal depth; | ||
255 | public IntPtr g1; | ||
256 | public IntPtr g2; | ||
257 | public int side1; | ||
258 | public int side2; | ||
259 | public static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(ContactGeom)); | ||
260 | } | ||
261 | |||
262 | [StructLayout(LayoutKind.Sequential)] | ||
263 | public struct GeomClass | ||
264 | { | ||
265 | public int bytes; | ||
266 | public GetColliderFnFn collider; | ||
267 | public GetAABBFn aabb; | ||
268 | public AABBTestFn aabb_test; | ||
269 | public GeomDtorFn dtor; | ||
270 | } | ||
271 | |||
272 | |||
273 | [StructLayout(LayoutKind.Sequential)] | ||
274 | public struct JointFeedback | ||
275 | { | ||
276 | public Vector3 f1; | ||
277 | public Vector3 t1; | ||
278 | public Vector3 f2; | ||
279 | public Vector3 t2; | ||
280 | } | ||
281 | |||
282 | |||
283 | [StructLayout(LayoutKind.Sequential)] | ||
284 | public struct Mass | ||
285 | { | ||
286 | public dReal mass; | ||
287 | public Vector4 c; | ||
288 | public Matrix3 I; | ||
289 | } | ||
290 | |||
291 | |||
292 | [StructLayout(LayoutKind.Sequential)] | ||
293 | public struct Matrix3 | ||
294 | { | ||
295 | public Matrix3(dReal m00, dReal m10, dReal m20, dReal m01, dReal m11, dReal m21, dReal m02, dReal m12, dReal m22) | ||
296 | { | ||
297 | M00 = m00; M10 = m10; M20 = m20; _m30 = 0.0f; | ||
298 | M01 = m01; M11 = m11; M21 = m21; _m31 = 0.0f; | ||
299 | M02 = m02; M12 = m12; M22 = m22; _m32 = 0.0f; | ||
300 | } | ||
301 | public dReal M00, M10, M20; | ||
302 | private dReal _m30; | ||
303 | public dReal M01, M11, M21; | ||
304 | private dReal _m31; | ||
305 | public dReal M02, M12, M22; | ||
306 | private dReal _m32; | ||
307 | } | ||
308 | |||
309 | [StructLayout(LayoutKind.Sequential)] | ||
310 | public struct Matrix4 | ||
311 | { | ||
312 | public Matrix4(dReal m00, dReal m10, dReal m20, dReal m30, | ||
313 | dReal m01, dReal m11, dReal m21, dReal m31, | ||
314 | dReal m02, dReal m12, dReal m22, dReal m32, | ||
315 | dReal m03, dReal m13, dReal m23, dReal m33) | ||
316 | { | ||
317 | M00 = m00; M10 = m10; M20 = m20; M30 = m30; | ||
318 | M01 = m01; M11 = m11; M21 = m21; M31 = m31; | ||
319 | M02 = m02; M12 = m12; M22 = m22; M32 = m32; | ||
320 | M03 = m03; M13 = m13; M23 = m23; M33 = m33; | ||
321 | } | ||
322 | public dReal M00, M10, M20, M30; | ||
323 | public dReal M01, M11, M21, M31; | ||
324 | public dReal M02, M12, M22, M32; | ||
325 | public dReal M03, M13, M23, M33; | ||
326 | } | ||
327 | |||
328 | [StructLayout(LayoutKind.Sequential)] | ||
329 | public struct Quaternion | ||
330 | { | ||
331 | public dReal W, X, Y, Z; | ||
332 | } | ||
333 | |||
334 | |||
335 | [StructLayout(LayoutKind.Sequential)] | ||
336 | public struct SurfaceParameters | ||
337 | { | ||
338 | public ContactFlags mode; | ||
339 | public dReal mu; | ||
340 | public dReal mu2; | ||
341 | public dReal bounce; | ||
342 | public dReal bounce_vel; | ||
343 | public dReal soft_erp; | ||
344 | public dReal soft_cfm; | ||
345 | public dReal motion1; | ||
346 | public dReal motion2; | ||
347 | public dReal motionN; | ||
348 | public dReal slip1; | ||
349 | public dReal slip2; | ||
350 | } | ||
351 | |||
352 | |||
353 | [StructLayout(LayoutKind.Sequential)] | ||
354 | public struct Vector3 | ||
355 | { | ||
356 | public Vector3(dReal x, dReal y, dReal z) | ||
357 | { | ||
358 | X = x; Y = y; Z = z; _w = 0.0f; | ||
359 | } | ||
360 | public dReal X, Y, Z; | ||
361 | private dReal _w; | ||
362 | } | ||
363 | |||
364 | |||
365 | [StructLayout(LayoutKind.Sequential)] | ||
366 | public struct Vector4 | ||
367 | { | ||
368 | public Vector4(dReal x, dReal y, dReal z, dReal w) | ||
369 | { | ||
370 | X = x; Y = y; Z = z; W = w; | ||
371 | } | ||
372 | public dReal X, Y, Z, W; | ||
373 | } | ||
374 | |||
375 | #endregion | ||
376 | |||
377 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAllocateODEDataForThread"), SuppressUnmanagedCodeSecurity] | ||
378 | public static extern int AllocateODEDataForThread(uint ODEInitFlags); | ||
379 | |||
380 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAreConnected"), SuppressUnmanagedCodeSecurity] | ||
381 | public static extern bool AreConnected(IntPtr b1, IntPtr b2); | ||
382 | |||
383 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAreConnectedExcluding"), SuppressUnmanagedCodeSecurity] | ||
384 | public static extern bool AreConnectedExcluding(IntPtr b1, IntPtr b2, JointType joint_type); | ||
385 | |||
386 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForce"), SuppressUnmanagedCodeSecurity] | ||
387 | public static extern void BodyAddForce(IntPtr body, dReal fx, dReal fy, dReal fz); | ||
388 | |||
389 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForceAtPos"), SuppressUnmanagedCodeSecurity] | ||
390 | public static extern void BodyAddForceAtPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); | ||
391 | |||
392 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForceAtRelPos"), SuppressUnmanagedCodeSecurity] | ||
393 | public static extern void BodyAddForceAtRelPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); | ||
394 | |||
395 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForce"), SuppressUnmanagedCodeSecurity] | ||
396 | public static extern void BodyAddRelForce(IntPtr body, dReal fx, dReal fy, dReal fz); | ||
397 | |||
398 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForceAtPos"), SuppressUnmanagedCodeSecurity] | ||
399 | public static extern void BodyAddRelForceAtPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); | ||
400 | |||
401 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForceAtRelPos"), SuppressUnmanagedCodeSecurity] | ||
402 | public static extern void BodyAddRelForceAtRelPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); | ||
403 | |||
404 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelTorque"), SuppressUnmanagedCodeSecurity] | ||
405 | public static extern void BodyAddRelTorque(IntPtr body, dReal fx, dReal fy, dReal fz); | ||
406 | |||
407 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddTorque"), SuppressUnmanagedCodeSecurity] | ||
408 | public static extern void BodyAddTorque(IntPtr body, dReal fx, dReal fy, dReal fz); | ||
409 | |||
410 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyPosition"), SuppressUnmanagedCodeSecurity] | ||
411 | public static extern void BodyCopyPosition(IntPtr body, out Vector3 pos); | ||
412 | |||
413 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyPosition"), SuppressUnmanagedCodeSecurity] | ||
414 | public static extern void BodyCopyPosition(IntPtr body, out dReal X); | ||
415 | |||
416 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyQuaternion"), SuppressUnmanagedCodeSecurity] | ||
417 | public static extern void BodyCopyQuaternion(IntPtr body, out Quaternion quat); | ||
418 | |||
419 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyQuaternion"), SuppressUnmanagedCodeSecurity] | ||
420 | public static extern void BodyCopyQuaternion(IntPtr body, out dReal X); | ||
421 | |||
422 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyRotation"), SuppressUnmanagedCodeSecurity] | ||
423 | public static extern void BodyCopyRotation(IntPtr body, out Matrix3 R); | ||
424 | |||
425 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyRotation"), SuppressUnmanagedCodeSecurity] | ||
426 | public static extern void BodyCopyRotation(IntPtr body, out dReal M00); | ||
427 | |||
428 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCreate"), SuppressUnmanagedCodeSecurity] | ||
429 | public static extern IntPtr BodyiCreate(IntPtr world); | ||
430 | public static IntPtr BodyCreate(IntPtr world) | ||
431 | { | ||
432 | NTotalBodies++; | ||
433 | return BodyiCreate(world); | ||
434 | } | ||
435 | |||
436 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyDestroy"), SuppressUnmanagedCodeSecurity] | ||
437 | public static extern void BodyiDestroy(IntPtr body); | ||
438 | public static void BodyDestroy(IntPtr body) | ||
439 | { | ||
440 | NTotalBodies--; | ||
441 | BodyiDestroy(body); | ||
442 | } | ||
443 | |||
444 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyDisable"), SuppressUnmanagedCodeSecurity] | ||
445 | public static extern void BodyDisable(IntPtr body); | ||
446 | |||
447 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyEnable"), SuppressUnmanagedCodeSecurity] | ||
448 | public static extern void BodyEnable(IntPtr body); | ||
449 | |||
450 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] | ||
451 | public static extern dReal BodyGetAutoDisableAngularThreshold(IntPtr body); | ||
452 | |||
453 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] | ||
454 | public static extern bool BodyGetAutoDisableFlag(IntPtr body); | ||
455 | |||
456 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableDefaults"), SuppressUnmanagedCodeSecurity] | ||
457 | public static extern void BodyGetAutoDisableDefaults(IntPtr body); | ||
458 | |||
459 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] | ||
460 | public static extern dReal BodyGetAutoDisableLinearThreshold(IntPtr body); | ||
461 | |||
462 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] | ||
463 | public static extern int BodyGetAutoDisableSteps(IntPtr body); | ||
464 | |||
465 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableTime"), SuppressUnmanagedCodeSecurity] | ||
466 | public static extern dReal BodyGetAutoDisableTime(IntPtr body); | ||
467 | |||
468 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularVel"), SuppressUnmanagedCodeSecurity] | ||
469 | public extern unsafe static Vector3* BodyGetAngularVelUnsafe(IntPtr body); | ||
470 | public static Vector3 BodyGetAngularVel(IntPtr body) | ||
471 | { | ||
472 | unsafe { return *(BodyGetAngularVelUnsafe(body)); } | ||
473 | } | ||
474 | |||
475 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetData"), SuppressUnmanagedCodeSecurity] | ||
476 | public static extern IntPtr BodyGetData(IntPtr body); | ||
477 | |||
478 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFiniteRotationMode"), SuppressUnmanagedCodeSecurity] | ||
479 | public static extern int BodyGetFiniteRotationMode(IntPtr body); | ||
480 | |||
481 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFiniteRotationAxis"), SuppressUnmanagedCodeSecurity] | ||
482 | public static extern void BodyGetFiniteRotationAxis(IntPtr body, out Vector3 result); | ||
483 | |||
484 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetForce"), SuppressUnmanagedCodeSecurity] | ||
485 | public extern unsafe static Vector3* BodyGetForceUnsafe(IntPtr body); | ||
486 | public static Vector3 BodyGetForce(IntPtr body) | ||
487 | { | ||
488 | unsafe { return *(BodyGetForceUnsafe(body)); } | ||
489 | } | ||
490 | |||
491 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetGravityMode"), SuppressUnmanagedCodeSecurity] | ||
492 | public static extern bool BodyGetGravityMode(IntPtr body); | ||
493 | |||
494 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetGyroscopicMode"), SuppressUnmanagedCodeSecurity] | ||
495 | public static extern int BodyGetGyroscopicMode(IntPtr body); | ||
496 | |||
497 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetJoint"), SuppressUnmanagedCodeSecurity] | ||
498 | public static extern IntPtr BodyGetJoint(IntPtr body, int index); | ||
499 | |||
500 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearVel"), SuppressUnmanagedCodeSecurity] | ||
501 | public extern unsafe static Vector3* BodyGetLinearVelUnsafe(IntPtr body); | ||
502 | public static Vector3 BodyGetLinearVel(IntPtr body) | ||
503 | { | ||
504 | unsafe { return *(BodyGetLinearVelUnsafe(body)); } | ||
505 | } | ||
506 | |||
507 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetMass"), SuppressUnmanagedCodeSecurity] | ||
508 | public static extern void BodyGetMass(IntPtr body, out Mass mass); | ||
509 | |||
510 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetNumJoints"), SuppressUnmanagedCodeSecurity] | ||
511 | public static extern int BodyGetNumJoints(IntPtr body); | ||
512 | |||
513 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPointVel"), SuppressUnmanagedCodeSecurity] | ||
514 | public static extern void BodyGetPointVel(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); | ||
515 | |||
516 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPosition"), SuppressUnmanagedCodeSecurity] | ||
517 | public extern unsafe static Vector3* BodyGetPositionUnsafe(IntPtr body); | ||
518 | public static Vector3 BodyGetPosition(IntPtr body) | ||
519 | { | ||
520 | unsafe { return *(BodyGetPositionUnsafe(body)); } | ||
521 | } | ||
522 | |||
523 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPosRelPoint"), SuppressUnmanagedCodeSecurity] | ||
524 | public static extern void BodyGetPosRelPoint(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); | ||
525 | |||
526 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
527 | public extern unsafe static Quaternion* BodyGetQuaternionUnsafe(IntPtr body); | ||
528 | public static Quaternion BodyGetQuaternion(IntPtr body) | ||
529 | { | ||
530 | unsafe { return *(BodyGetQuaternionUnsafe(body)); } | ||
531 | } | ||
532 | |||
533 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRelPointPos"), SuppressUnmanagedCodeSecurity] | ||
534 | public static extern void BodyGetRelPointPos(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); | ||
535 | |||
536 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRelPointVel"), SuppressUnmanagedCodeSecurity] | ||
537 | public static extern void BodyGetRelPointVel(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); | ||
538 | |||
539 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRotation"), SuppressUnmanagedCodeSecurity] | ||
540 | public extern unsafe static Matrix3* BodyGetRotationUnsafe(IntPtr body); | ||
541 | public static Matrix3 BodyGetRotation(IntPtr body) | ||
542 | { | ||
543 | unsafe { return *(BodyGetRotationUnsafe(body)); } | ||
544 | } | ||
545 | |||
546 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetTorque"), SuppressUnmanagedCodeSecurity] | ||
547 | public extern unsafe static Vector3* BodyGetTorqueUnsafe(IntPtr body); | ||
548 | public static Vector3 BodyGetTorque(IntPtr body) | ||
549 | { | ||
550 | unsafe { return *(BodyGetTorqueUnsafe(body)); } | ||
551 | } | ||
552 | |||
553 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetWorld"), SuppressUnmanagedCodeSecurity] | ||
554 | public static extern IntPtr BodyGetWorld(IntPtr body); | ||
555 | |||
556 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFirstGeom"), SuppressUnmanagedCodeSecurity] | ||
557 | public static extern IntPtr BodyGetFirstGeom(IntPtr body); | ||
558 | |||
559 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetNextGeom"), SuppressUnmanagedCodeSecurity] | ||
560 | public static extern IntPtr dBodyGetNextGeom(IntPtr Geom); | ||
561 | |||
562 | |||
563 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyIsEnabled"), SuppressUnmanagedCodeSecurity] | ||
564 | public static extern bool BodyIsEnabled(IntPtr body); | ||
565 | |||
566 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularVel"), SuppressUnmanagedCodeSecurity] | ||
567 | public static extern void BodySetAngularVel(IntPtr body, dReal x, dReal y, dReal z); | ||
568 | |||
569 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] | ||
570 | public static extern void BodySetAutoDisableAngularThreshold(IntPtr body, dReal angular_threshold); | ||
571 | |||
572 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableDefaults"), SuppressUnmanagedCodeSecurity] | ||
573 | public static extern void BodySetAutoDisableDefaults(IntPtr body); | ||
574 | |||
575 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] | ||
576 | public static extern void BodySetAutoDisableFlag(IntPtr body, bool do_auto_disable); | ||
577 | |||
578 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] | ||
579 | public static extern void BodySetAutoDisableLinearThreshold(IntPtr body, dReal linear_threshold); | ||
580 | |||
581 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] | ||
582 | public static extern void BodySetAutoDisableSteps(IntPtr body, int steps); | ||
583 | |||
584 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableTime"), SuppressUnmanagedCodeSecurity] | ||
585 | public static extern void BodySetAutoDisableTime(IntPtr body, dReal time); | ||
586 | |||
587 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetData"), SuppressUnmanagedCodeSecurity] | ||
588 | public static extern void BodySetData(IntPtr body, IntPtr data); | ||
589 | |||
590 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetFiniteRotationMode"), SuppressUnmanagedCodeSecurity] | ||
591 | public static extern void BodySetFiniteRotationMode(IntPtr body, int mode); | ||
592 | |||
593 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetFiniteRotationAxis"), SuppressUnmanagedCodeSecurity] | ||
594 | public static extern void BodySetFiniteRotationAxis(IntPtr body, dReal x, dReal y, dReal z); | ||
595 | |||
596 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearDamping"), SuppressUnmanagedCodeSecurity] | ||
597 | public static extern void BodySetLinearDamping(IntPtr body, dReal scale); | ||
598 | |||
599 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDamping"), SuppressUnmanagedCodeSecurity] | ||
600 | public static extern void BodySetAngularDamping(IntPtr body, dReal scale); | ||
601 | |||
602 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearDamping"), SuppressUnmanagedCodeSecurity] | ||
603 | public static extern dReal BodyGetLinearDamping(IntPtr body); | ||
604 | |||
605 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularDamping"), SuppressUnmanagedCodeSecurity] | ||
606 | public static extern dReal BodyGetAngularDamping(IntPtr body); | ||
607 | |||
608 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDamping"), SuppressUnmanagedCodeSecurity] | ||
609 | public static extern void BodySetDamping(IntPtr body, dReal linear_scale, dReal angular_scale); | ||
610 | |||
611 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] | ||
612 | public static extern void BodySetAngularDampingThreshold(IntPtr body, dReal threshold); | ||
613 | |||
614 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] | ||
615 | public static extern void BodySetLinearDampingThreshold(IntPtr body, dReal threshold); | ||
616 | |||
617 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] | ||
618 | public static extern dReal BodyGetLinearDampingThreshold(IntPtr body); | ||
619 | |||
620 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] | ||
621 | public static extern dReal BodyGetAngularDampingThreshold(IntPtr body); | ||
622 | |||
623 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetForce"), SuppressUnmanagedCodeSecurity] | ||
624 | public static extern void BodySetForce(IntPtr body, dReal x, dReal y, dReal z); | ||
625 | |||
626 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetGravityMode"), SuppressUnmanagedCodeSecurity] | ||
627 | public static extern void BodySetGravityMode(IntPtr body, bool mode); | ||
628 | |||
629 | /// <summary> | ||
630 | /// Sets the Gyroscopic term status on the body specified. | ||
631 | /// </summary> | ||
632 | /// <param name="body">Pointer to body</param> | ||
633 | /// <param name="enabled">NonZero enabled, Zero disabled</param> | ||
634 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetGyroscopicMode"), SuppressUnmanagedCodeSecurity] | ||
635 | public static extern void dBodySetGyroscopicMode(IntPtr body, int enabled); | ||
636 | |||
637 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearVel"), SuppressUnmanagedCodeSecurity] | ||
638 | public static extern void BodySetLinearVel(IntPtr body, dReal x, dReal y, dReal z); | ||
639 | |||
640 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetMass"), SuppressUnmanagedCodeSecurity] | ||
641 | public static extern void BodySetMass(IntPtr body, ref Mass mass); | ||
642 | |||
643 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetPosition"), SuppressUnmanagedCodeSecurity] | ||
644 | public static extern void BodySetPosition(IntPtr body, dReal x, dReal y, dReal z); | ||
645 | |||
646 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
647 | public static extern void BodySetQuaternion(IntPtr body, ref Quaternion q); | ||
648 | |||
649 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
650 | public static extern void BodySetQuaternion(IntPtr body, ref dReal w); | ||
651 | |||
652 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetRotation"), SuppressUnmanagedCodeSecurity] | ||
653 | public static extern void BodySetRotation(IntPtr body, ref Matrix3 R); | ||
654 | |||
655 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetRotation"), SuppressUnmanagedCodeSecurity] | ||
656 | public static extern void BodySetRotation(IntPtr body, ref dReal M00); | ||
657 | |||
658 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetTorque"), SuppressUnmanagedCodeSecurity] | ||
659 | public static extern void BodySetTorque(IntPtr body, dReal x, dReal y, dReal z); | ||
660 | |||
661 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyVectorFromWorld"), SuppressUnmanagedCodeSecurity] | ||
662 | public static extern void BodyVectorFromWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); | ||
663 | |||
664 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyVectorToWorld"), SuppressUnmanagedCodeSecurity] | ||
665 | public static extern void BodyVectorToWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); | ||
666 | |||
667 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBoxBox"), SuppressUnmanagedCodeSecurity] | ||
668 | public static extern void BoxBox(ref Vector3 p1, ref Matrix3 R1, | ||
669 | ref Vector3 side1, ref Vector3 p2, | ||
670 | ref Matrix3 R2, ref Vector3 side2, | ||
671 | ref Vector3 normal, out dReal depth, out int return_code, | ||
672 | int maxc, out ContactGeom contact, int skip); | ||
673 | |||
674 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBoxTouchesBox"), SuppressUnmanagedCodeSecurity] | ||
675 | public static extern void BoxTouchesBox(ref Vector3 _p1, ref Matrix3 R1, | ||
676 | ref Vector3 side1, ref Vector3 _p2, | ||
677 | ref Matrix3 R2, ref Vector3 side2); | ||
678 | |||
679 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCleanupODEAllDataForThread"), SuppressUnmanagedCodeSecurity] | ||
680 | public static extern void CleanupODEAllDataForThread(); | ||
681 | |||
682 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dClosestLineSegmentPoints"), SuppressUnmanagedCodeSecurity] | ||
683 | public static extern void ClosestLineSegmentPoints(ref Vector3 a1, ref Vector3 a2, | ||
684 | ref Vector3 b1, ref Vector3 b2, | ||
685 | ref Vector3 cp1, ref Vector3 cp2); | ||
686 | |||
687 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCloseODE"), SuppressUnmanagedCodeSecurity] | ||
688 | public static extern void CloseODE(); | ||
689 | |||
690 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCollide"), SuppressUnmanagedCodeSecurity] | ||
691 | public static extern int Collide(IntPtr o1, IntPtr o2, int flags, [In, Out] ContactGeom[] contact, int skip); | ||
692 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCollide"), SuppressUnmanagedCodeSecurity] | ||
693 | public static extern int CollidePtr(IntPtr o1, IntPtr o2, int flags, IntPtr contactgeomarray, int skip); | ||
694 | |||
695 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dConnectingJoint"), SuppressUnmanagedCodeSecurity] | ||
696 | public static extern IntPtr ConnectingJoint(IntPtr j1, IntPtr j2); | ||
697 | |||
698 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateBox"), SuppressUnmanagedCodeSecurity] | ||
699 | public static extern IntPtr CreateiBox(IntPtr space, dReal lx, dReal ly, dReal lz); | ||
700 | public static IntPtr CreateBox(IntPtr space, dReal lx, dReal ly, dReal lz) | ||
701 | { | ||
702 | NTotalGeoms++; | ||
703 | return CreateiBox(space, lx, ly, lz); | ||
704 | } | ||
705 | |||
706 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateCapsule"), SuppressUnmanagedCodeSecurity] | ||
707 | public static extern IntPtr CreateiCapsule(IntPtr space, dReal radius, dReal length); | ||
708 | public static IntPtr CreateCapsule(IntPtr space, dReal radius, dReal length) | ||
709 | { | ||
710 | NTotalGeoms++; | ||
711 | return CreateiCapsule(space, radius, length); | ||
712 | } | ||
713 | |||
714 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateConvex"), SuppressUnmanagedCodeSecurity] | ||
715 | public static extern IntPtr CreateiConvex(IntPtr space, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); | ||
716 | public static IntPtr CreateConvex(IntPtr space, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons) | ||
717 | { | ||
718 | NTotalGeoms++; | ||
719 | return CreateiConvex(space, planes, planeCount, points, pointCount, polygons); | ||
720 | } | ||
721 | |||
722 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateCylinder"), SuppressUnmanagedCodeSecurity] | ||
723 | public static extern IntPtr CreateiCylinder(IntPtr space, dReal radius, dReal length); | ||
724 | public static IntPtr CreateCylinder(IntPtr space, dReal radius, dReal length) | ||
725 | { | ||
726 | NTotalGeoms++; | ||
727 | return CreateiCylinder(space, radius, length); | ||
728 | } | ||
729 | |||
730 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateHeightfield"), SuppressUnmanagedCodeSecurity] | ||
731 | public static extern IntPtr CreateiHeightfield(IntPtr space, IntPtr data, int bPlaceable); | ||
732 | public static IntPtr CreateHeightfield(IntPtr space, IntPtr data, int bPlaceable) | ||
733 | { | ||
734 | NTotalGeoms++; | ||
735 | return CreateiHeightfield(space, data, bPlaceable); | ||
736 | } | ||
737 | |||
738 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateOSTerrain"), SuppressUnmanagedCodeSecurity] | ||
739 | public static extern IntPtr CreateiOSTerrain(IntPtr space, IntPtr data, int bPlaceable); | ||
740 | public static IntPtr CreateOSTerrain(IntPtr space, IntPtr data, int bPlaceable) | ||
741 | { | ||
742 | NTotalGeoms++; | ||
743 | return CreateiOSTerrain(space, data, bPlaceable); | ||
744 | } | ||
745 | |||
746 | |||
747 | |||
748 | |||
749 | |||
750 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeom"), SuppressUnmanagedCodeSecurity] | ||
751 | public static extern IntPtr CreateiGeom(int classnum); | ||
752 | public static IntPtr CreateGeom(int classnum) | ||
753 | { | ||
754 | NTotalGeoms++; | ||
755 | return CreateiGeom(classnum); | ||
756 | } | ||
757 | |||
758 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomClass"), SuppressUnmanagedCodeSecurity] | ||
759 | public static extern int CreateGeomClass(ref GeomClass classptr); | ||
760 | |||
761 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomTransform"), SuppressUnmanagedCodeSecurity] | ||
762 | public static extern IntPtr CreateGeomTransform(IntPtr space); | ||
763 | |||
764 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreatePlane"), SuppressUnmanagedCodeSecurity] | ||
765 | public static extern IntPtr CreateiPlane(IntPtr space, dReal a, dReal b, dReal c, dReal d); | ||
766 | public static IntPtr CreatePlane(IntPtr space, dReal a, dReal b, dReal c, dReal d) | ||
767 | { | ||
768 | NTotalGeoms++; | ||
769 | return CreateiPlane(space, a, b, c, d); | ||
770 | } | ||
771 | |||
772 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateRay"), SuppressUnmanagedCodeSecurity] | ||
773 | public static extern IntPtr CreateiRay(IntPtr space, dReal length); | ||
774 | public static IntPtr CreateRay(IntPtr space, dReal length) | ||
775 | { | ||
776 | NTotalGeoms++; | ||
777 | return CreateiRay(space, length); | ||
778 | } | ||
779 | |||
780 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateSphere"), SuppressUnmanagedCodeSecurity] | ||
781 | public static extern IntPtr CreateiSphere(IntPtr space, dReal radius); | ||
782 | public static IntPtr CreateSphere(IntPtr space, dReal radius) | ||
783 | { | ||
784 | NTotalGeoms++; | ||
785 | return CreateiSphere(space, radius); | ||
786 | } | ||
787 | |||
788 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateTriMesh"), SuppressUnmanagedCodeSecurity] | ||
789 | public static extern IntPtr CreateiTriMesh(IntPtr space, IntPtr data, | ||
790 | TriCallback callback, TriArrayCallback arrayCallback, TriRayCallback rayCallback); | ||
791 | public static IntPtr CreateTriMesh(IntPtr space, IntPtr data, | ||
792 | TriCallback callback, TriArrayCallback arrayCallback, TriRayCallback rayCallback) | ||
793 | { | ||
794 | NTotalGeoms++; | ||
795 | return CreateiTriMesh(space, data, callback, arrayCallback, rayCallback); | ||
796 | } | ||
797 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dDot"), SuppressUnmanagedCodeSecurity] | ||
798 | public static extern dReal Dot(ref dReal X0, ref dReal X1, int n); | ||
799 | |||
800 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dDQfromW"), SuppressUnmanagedCodeSecurity] | ||
801 | public static extern void DQfromW(dReal[] dq, ref Vector3 w, ref Quaternion q); | ||
802 | |||
803 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dFactorCholesky"), SuppressUnmanagedCodeSecurity] | ||
804 | public static extern int FactorCholesky(ref dReal A00, int n); | ||
805 | |||
806 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dFactorLDLT"), SuppressUnmanagedCodeSecurity] | ||
807 | public static extern void FactorLDLT(ref dReal A, out dReal d, int n, int nskip); | ||
808 | |||
809 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxGetLengths"), SuppressUnmanagedCodeSecurity] | ||
810 | public static extern void GeomBoxGetLengths(IntPtr geom, out Vector3 len); | ||
811 | |||
812 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxGetLengths"), SuppressUnmanagedCodeSecurity] | ||
813 | public static extern void GeomBoxGetLengths(IntPtr geom, out dReal x); | ||
814 | |||
815 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxPointDepth"), SuppressUnmanagedCodeSecurity] | ||
816 | public static extern dReal GeomBoxPointDepth(IntPtr geom, dReal x, dReal y, dReal z); | ||
817 | |||
818 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxSetLengths"), SuppressUnmanagedCodeSecurity] | ||
819 | public static extern void GeomBoxSetLengths(IntPtr geom, dReal x, dReal y, dReal z); | ||
820 | |||
821 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsuleGetParams"), SuppressUnmanagedCodeSecurity] | ||
822 | public static extern void GeomCapsuleGetParams(IntPtr geom, out dReal radius, out dReal length); | ||
823 | |||
824 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsulePointDepth"), SuppressUnmanagedCodeSecurity] | ||
825 | public static extern dReal GeomCapsulePointDepth(IntPtr geom, dReal x, dReal y, dReal z); | ||
826 | |||
827 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsuleSetParams"), SuppressUnmanagedCodeSecurity] | ||
828 | public static extern void GeomCapsuleSetParams(IntPtr geom, dReal radius, dReal length); | ||
829 | |||
830 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomClearOffset"), SuppressUnmanagedCodeSecurity] | ||
831 | public static extern void GeomClearOffset(IntPtr geom); | ||
832 | |||
833 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetPosition"), SuppressUnmanagedCodeSecurity] | ||
834 | public static extern IntPtr GeomCopyOffsetPosition(IntPtr geom, ref Vector3 pos); | ||
835 | |||
836 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetPosition"), SuppressUnmanagedCodeSecurity] | ||
837 | public static extern IntPtr GeomCopyOffsetPosition(IntPtr geom, ref dReal X); | ||
838 | |||
839 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
840 | public static extern void GeomCopyOffsetQuaternion(IntPtr geom, ref Quaternion Q); | ||
841 | |||
842 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
843 | public static extern void GeomCopyOffsetQuaternion(IntPtr geom, ref dReal X); | ||
844 | |||
845 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetRotation"), SuppressUnmanagedCodeSecurity] | ||
846 | public static extern IntPtr GeomCopyOffsetRotation(IntPtr geom, ref Matrix3 R); | ||
847 | |||
848 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetRotation"), SuppressUnmanagedCodeSecurity] | ||
849 | public static extern IntPtr GeomCopyOffsetRotation(IntPtr geom, ref dReal M00); | ||
850 | |||
851 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyPosition"), SuppressUnmanagedCodeSecurity] | ||
852 | public static extern void GeomCopyPosition(IntPtr geom, out Vector3 pos); | ||
853 | |||
854 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyPosition"), SuppressUnmanagedCodeSecurity] | ||
855 | public static extern void GeomCopyPosition(IntPtr geom, out dReal X); | ||
856 | |||
857 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyRotation"), SuppressUnmanagedCodeSecurity] | ||
858 | public static extern void GeomCopyRotation(IntPtr geom, out Matrix3 R); | ||
859 | |||
860 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyRotation"), SuppressUnmanagedCodeSecurity] | ||
861 | public static extern void GeomCopyRotation(IntPtr geom, out dReal M00); | ||
862 | |||
863 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCylinderGetParams"), SuppressUnmanagedCodeSecurity] | ||
864 | public static extern void GeomCylinderGetParams(IntPtr geom, out dReal radius, out dReal length); | ||
865 | |||
866 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCylinderSetParams"), SuppressUnmanagedCodeSecurity] | ||
867 | public static extern void GeomCylinderSetParams(IntPtr geom, dReal radius, dReal length); | ||
868 | |||
869 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomDestroy"), SuppressUnmanagedCodeSecurity] | ||
870 | public static extern void GeomiDestroy(IntPtr geom); | ||
871 | public static void GeomDestroy(IntPtr geom) | ||
872 | { | ||
873 | NTotalGeoms--; | ||
874 | GeomiDestroy(geom); | ||
875 | } | ||
876 | |||
877 | |||
878 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomDisable"), SuppressUnmanagedCodeSecurity] | ||
879 | public static extern void GeomDisable(IntPtr geom); | ||
880 | |||
881 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomEnable"), SuppressUnmanagedCodeSecurity] | ||
882 | public static extern void GeomEnable(IntPtr geom); | ||
883 | |||
884 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetAABB"), SuppressUnmanagedCodeSecurity] | ||
885 | public static extern void GeomGetAABB(IntPtr geom, out AABB aabb); | ||
886 | |||
887 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetAABB"), SuppressUnmanagedCodeSecurity] | ||
888 | public static extern void GeomGetAABB(IntPtr geom, out dReal minX); | ||
889 | |||
890 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetBody"), SuppressUnmanagedCodeSecurity] | ||
891 | public static extern IntPtr GeomGetBody(IntPtr geom); | ||
892 | |||
893 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetCategoryBits"), SuppressUnmanagedCodeSecurity] | ||
894 | public static extern uint GeomGetCategoryBits(IntPtr geom); | ||
895 | |||
896 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetClassData"), SuppressUnmanagedCodeSecurity] | ||
897 | public static extern IntPtr GeomGetClassData(IntPtr geom); | ||
898 | |||
899 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetCollideBits"), SuppressUnmanagedCodeSecurity] | ||
900 | public static extern uint GeomGetCollideBits(IntPtr geom); | ||
901 | |||
902 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetClass"), SuppressUnmanagedCodeSecurity] | ||
903 | public static extern GeomClassID GeomGetClass(IntPtr geom); | ||
904 | |||
905 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetData"), SuppressUnmanagedCodeSecurity] | ||
906 | public static extern IntPtr GeomGetData(IntPtr geom); | ||
907 | |||
908 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetPosition"), SuppressUnmanagedCodeSecurity] | ||
909 | public extern unsafe static Vector3* GeomGetOffsetPositionUnsafe(IntPtr geom); | ||
910 | public static Vector3 GeomGetOffsetPosition(IntPtr geom) | ||
911 | { | ||
912 | unsafe { return *(GeomGetOffsetPositionUnsafe(geom)); } | ||
913 | } | ||
914 | |||
915 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetRotation"), SuppressUnmanagedCodeSecurity] | ||
916 | public extern unsafe static Matrix3* GeomGetOffsetRotationUnsafe(IntPtr geom); | ||
917 | public static Matrix3 GeomGetOffsetRotation(IntPtr geom) | ||
918 | { | ||
919 | unsafe { return *(GeomGetOffsetRotationUnsafe(geom)); } | ||
920 | } | ||
921 | |||
922 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetPosition"), SuppressUnmanagedCodeSecurity] | ||
923 | public extern unsafe static Vector3* GeomGetPositionUnsafe(IntPtr geom); | ||
924 | public static Vector3 GeomGetPosition(IntPtr geom) | ||
925 | { | ||
926 | unsafe { return *(GeomGetPositionUnsafe(geom)); } | ||
927 | } | ||
928 | public static OMV.Vector3 GeomGetPositionOMV(IntPtr geom) | ||
929 | { | ||
930 | Vector3 vtmp = GeomGetPosition(geom); | ||
931 | return new OMV.Vector3(vtmp.X, vtmp.Y, vtmp.Z); | ||
932 | } | ||
933 | |||
934 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
935 | public static extern void GeomCopyQuaternion(IntPtr geom, out Quaternion q); | ||
936 | public static OMV.Quaternion GeomGetQuaternionOMV(IntPtr geom) | ||
937 | { | ||
938 | Quaternion qtmp; | ||
939 | GeomCopyQuaternion(geom, out qtmp); | ||
940 | return new OMV.Quaternion(qtmp.X, qtmp.Y, qtmp.Z, qtmp.W); | ||
941 | } | ||
942 | |||
943 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
944 | public static extern void GeomCopyQuaternion(IntPtr geom, out dReal X); | ||
945 | |||
946 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetRotation"), SuppressUnmanagedCodeSecurity] | ||
947 | public extern unsafe static Matrix3* GeomGetRotationUnsafe(IntPtr geom); | ||
948 | public static Matrix3 GeomGetRotation(IntPtr geom) | ||
949 | { | ||
950 | unsafe { return *(GeomGetRotationUnsafe(geom)); } | ||
951 | } | ||
952 | |||
953 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetSpace"), SuppressUnmanagedCodeSecurity] | ||
954 | public static extern IntPtr GeomGetSpace(IntPtr geom); | ||
955 | |||
956 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildByte"), SuppressUnmanagedCodeSecurity] | ||
957 | public static extern void GeomHeightfieldDataBuildByte(IntPtr d, byte[] pHeightData, int bCopyHeightData, | ||
958 | dReal width, dReal depth, int widthSamples, int depthSamples, | ||
959 | dReal scale, dReal offset, dReal thickness, int bWrap); | ||
960 | |||
961 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildByte"), SuppressUnmanagedCodeSecurity] | ||
962 | public static extern void GeomHeightfieldDataBuildByte(IntPtr d, IntPtr pHeightData, int bCopyHeightData, | ||
963 | dReal width, dReal depth, int widthSamples, int depthSamples, | ||
964 | dReal scale, dReal offset, dReal thickness, int bWrap); | ||
965 | |||
966 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildCallback"), SuppressUnmanagedCodeSecurity] | ||
967 | public static extern void GeomHeightfieldDataBuildCallback(IntPtr d, IntPtr pUserData, HeightfieldGetHeight pCallback, | ||
968 | dReal width, dReal depth, int widthSamples, int depthSamples, | ||
969 | dReal scale, dReal offset, dReal thickness, int bWrap); | ||
970 | |||
971 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity] | ||
972 | public static extern void GeomHeightfieldDataBuildShort(IntPtr d, ushort[] pHeightData, int bCopyHeightData, | ||
973 | dReal width, dReal depth, int widthSamples, int depthSamples, | ||
974 | dReal scale, dReal offset, dReal thickness, int bWrap); | ||
975 | |||
976 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity] | ||
977 | public static extern void GeomHeightfieldDataBuildShort(IntPtr d, short[] pHeightData, int bCopyHeightData, | ||
978 | dReal width, dReal depth, int widthSamples, int depthSamples, | ||
979 | dReal scale, dReal offset, dReal thickness, int bWrap); | ||
980 | |||
981 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity] | ||
982 | public static extern void GeomHeightfieldDataBuildShort(IntPtr d, IntPtr pHeightData, int bCopyHeightData, | ||
983 | dReal width, dReal depth, int widthSamples, int depthSamples, | ||
984 | dReal scale, dReal offset, dReal thickness, int bWrap); | ||
985 | |||
986 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildSingle"), SuppressUnmanagedCodeSecurity] | ||
987 | public static extern void GeomHeightfieldDataBuildSingle(IntPtr d, float[] pHeightData, int bCopyHeightData, | ||
988 | dReal width, dReal depth, int widthSamples, int depthSamples, | ||
989 | dReal scale, dReal offset, dReal thickness, int bWrap); | ||
990 | |||
991 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildSingle"), SuppressUnmanagedCodeSecurity] | ||
992 | public static extern void GeomHeightfieldDataBuildSingle(IntPtr d, IntPtr pHeightData, int bCopyHeightData, | ||
993 | dReal width, dReal depth, int widthSamples, int depthSamples, | ||
994 | dReal scale, dReal offset, dReal thickness, int bWrap); | ||
995 | |||
996 | |||
997 | |||
998 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildDouble"), SuppressUnmanagedCodeSecurity] | ||
999 | public static extern void GeomHeightfieldDataBuildDouble(IntPtr d, double[] pHeightData, int bCopyHeightData, | ||
1000 | dReal width, dReal depth, int widthSamples, int depthSamples, | ||
1001 | dReal scale, dReal offset, dReal thickness, int bWrap); | ||
1002 | |||
1003 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildDouble"), SuppressUnmanagedCodeSecurity] | ||
1004 | public static extern void GeomHeightfieldDataBuildDouble(IntPtr d, IntPtr pHeightData, int bCopyHeightData, | ||
1005 | dReal width, dReal depth, int widthSamples, int depthSamples, | ||
1006 | dReal scale, dReal offset, dReal thickness, int bWrap); | ||
1007 | |||
1008 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataCreate"), SuppressUnmanagedCodeSecurity] | ||
1009 | public static extern IntPtr GeomHeightfieldDataCreate(); | ||
1010 | |||
1011 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataDestroy"), SuppressUnmanagedCodeSecurity] | ||
1012 | public static extern void GeomHeightfieldDataDestroy(IntPtr d); | ||
1013 | |||
1014 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataSetBounds"), SuppressUnmanagedCodeSecurity] | ||
1015 | public static extern void GeomHeightfieldDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight); | ||
1016 | |||
1017 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldGetHeightfieldData"), SuppressUnmanagedCodeSecurity] | ||
1018 | public static extern IntPtr GeomHeightfieldGetHeightfieldData(IntPtr g); | ||
1019 | |||
1020 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldSetHeightfieldData"), SuppressUnmanagedCodeSecurity] | ||
1021 | public static extern void GeomHeightfieldSetHeightfieldData(IntPtr g, IntPtr d); | ||
1022 | |||
1023 | |||
1024 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomUbitTerrainDataBuild"), SuppressUnmanagedCodeSecurity] | ||
1025 | public static extern void GeomOSTerrainDataBuild(IntPtr d, float[] pHeightData, int bCopyHeightData, | ||
1026 | dReal sampleSize, int widthSamples, int depthSamples, | ||
1027 | dReal offset, dReal thickness, int bWrap); | ||
1028 | |||
1029 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataBuild"), SuppressUnmanagedCodeSecurity] | ||
1030 | public static extern void GeomOSTerrainDataBuild(IntPtr d, IntPtr pHeightData, int bCopyHeightData, | ||
1031 | dReal sampleSize, int widthSamples, int depthSamples, | ||
1032 | dReal thickness, int bWrap); | ||
1033 | |||
1034 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataCreate"), SuppressUnmanagedCodeSecurity] | ||
1035 | public static extern IntPtr GeomOSTerrainDataCreate(); | ||
1036 | |||
1037 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataDestroy"), SuppressUnmanagedCodeSecurity] | ||
1038 | public static extern void GeomOSTerrainDataDestroy(IntPtr d); | ||
1039 | |||
1040 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataSetBounds"), SuppressUnmanagedCodeSecurity] | ||
1041 | public static extern void GeomOSTerrainDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight); | ||
1042 | |||
1043 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainGetHeightfieldData"), SuppressUnmanagedCodeSecurity] | ||
1044 | public static extern IntPtr GeomOSTerrainGetHeightfieldData(IntPtr g); | ||
1045 | |||
1046 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainSetHeightfieldData"), SuppressUnmanagedCodeSecurity] | ||
1047 | public static extern void GeomOSTerrainSetHeightfieldData(IntPtr g, IntPtr d); | ||
1048 | |||
1049 | |||
1050 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsEnabled"), SuppressUnmanagedCodeSecurity] | ||
1051 | public static extern bool GeomIsEnabled(IntPtr geom); | ||
1052 | |||
1053 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsOffset"), SuppressUnmanagedCodeSecurity] | ||
1054 | public static extern bool GeomIsOffset(IntPtr geom); | ||
1055 | |||
1056 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsSpace"), SuppressUnmanagedCodeSecurity] | ||
1057 | public static extern bool GeomIsSpace(IntPtr geom); | ||
1058 | |||
1059 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneGetParams"), SuppressUnmanagedCodeSecurity] | ||
1060 | public static extern void GeomPlaneGetParams(IntPtr geom, ref Vector4 result); | ||
1061 | |||
1062 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneGetParams"), SuppressUnmanagedCodeSecurity] | ||
1063 | public static extern void GeomPlaneGetParams(IntPtr geom, ref dReal A); | ||
1064 | |||
1065 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlanePointDepth"), SuppressUnmanagedCodeSecurity] | ||
1066 | public static extern dReal GeomPlanePointDepth(IntPtr geom, dReal x, dReal y, dReal z); | ||
1067 | |||
1068 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneSetParams"), SuppressUnmanagedCodeSecurity] | ||
1069 | public static extern void GeomPlaneSetParams(IntPtr plane, dReal a, dReal b, dReal c, dReal d); | ||
1070 | |||
1071 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGet"), SuppressUnmanagedCodeSecurity] | ||
1072 | public static extern void GeomRayGet(IntPtr ray, ref Vector3 start, ref Vector3 dir); | ||
1073 | |||
1074 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGet"), SuppressUnmanagedCodeSecurity] | ||
1075 | public static extern void GeomRayGet(IntPtr ray, ref dReal startX, ref dReal dirX); | ||
1076 | |||
1077 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetClosestHit"), SuppressUnmanagedCodeSecurity] | ||
1078 | public static extern int GeomRayGetClosestHit(IntPtr ray); | ||
1079 | |||
1080 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetLength"), SuppressUnmanagedCodeSecurity] | ||
1081 | public static extern dReal GeomRayGetLength(IntPtr ray); | ||
1082 | |||
1083 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetParams"), SuppressUnmanagedCodeSecurity] | ||
1084 | public static extern dReal GeomRayGetParams(IntPtr g, out int firstContact, out int backfaceCull); | ||
1085 | |||
1086 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySet"), SuppressUnmanagedCodeSecurity] | ||
1087 | public static extern void GeomRaySet(IntPtr ray, dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz); | ||
1088 | |||
1089 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetClosestHit"), SuppressUnmanagedCodeSecurity] | ||
1090 | public static extern void GeomRaySetClosestHit(IntPtr ray, int closestHit); | ||
1091 | |||
1092 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetLength"), SuppressUnmanagedCodeSecurity] | ||
1093 | public static extern void GeomRaySetLength(IntPtr ray, dReal length); | ||
1094 | |||
1095 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetParams"), SuppressUnmanagedCodeSecurity] | ||
1096 | public static extern void GeomRaySetParams(IntPtr ray, int firstContact, int backfaceCull); | ||
1097 | |||
1098 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetBody"), SuppressUnmanagedCodeSecurity] | ||
1099 | public static extern void GeomSetBody(IntPtr geom, IntPtr body); | ||
1100 | |||
1101 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetCategoryBits"), SuppressUnmanagedCodeSecurity] | ||
1102 | public static extern void GeomSetCategoryBits(IntPtr geom, uint bits); | ||
1103 | |||
1104 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetCollideBits"), SuppressUnmanagedCodeSecurity] | ||
1105 | public static extern void GeomSetCollideBits(IntPtr geom, uint bits); | ||
1106 | |||
1107 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetConvex"), SuppressUnmanagedCodeSecurity] | ||
1108 | public static extern IntPtr GeomSetConvex(IntPtr geom, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); | ||
1109 | |||
1110 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetData"), SuppressUnmanagedCodeSecurity] | ||
1111 | public static extern void GeomSetData(IntPtr geom, IntPtr data); | ||
1112 | |||
1113 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetPosition"), SuppressUnmanagedCodeSecurity] | ||
1114 | public static extern void GeomSetOffsetPosition(IntPtr geom, dReal x, dReal y, dReal z); | ||
1115 | |||
1116 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
1117 | public static extern void GeomSetOffsetQuaternion(IntPtr geom, ref Quaternion Q); | ||
1118 | |||
1119 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
1120 | public static extern void GeomSetOffsetQuaternion(IntPtr geom, ref dReal X); | ||
1121 | |||
1122 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetRotation"), SuppressUnmanagedCodeSecurity] | ||
1123 | public static extern void GeomSetOffsetRotation(IntPtr geom, ref Matrix3 R); | ||
1124 | |||
1125 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetRotation"), SuppressUnmanagedCodeSecurity] | ||
1126 | public static extern void GeomSetOffsetRotation(IntPtr geom, ref dReal M00); | ||
1127 | |||
1128 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldPosition"), SuppressUnmanagedCodeSecurity] | ||
1129 | public static extern void GeomSetOffsetWorldPosition(IntPtr geom, dReal x, dReal y, dReal z); | ||
1130 | |||
1131 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldQuaternion"), SuppressUnmanagedCodeSecurity] | ||
1132 | public static extern void GeomSetOffsetWorldQuaternion(IntPtr geom, ref Quaternion Q); | ||
1133 | |||
1134 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldQuaternion"), SuppressUnmanagedCodeSecurity] | ||
1135 | public static extern void GeomSetOffsetWorldQuaternion(IntPtr geom, ref dReal X); | ||
1136 | |||
1137 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldRotation"), SuppressUnmanagedCodeSecurity] | ||
1138 | public static extern void GeomSetOffsetWorldRotation(IntPtr geom, ref Matrix3 R); | ||
1139 | |||
1140 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldRotation"), SuppressUnmanagedCodeSecurity] | ||
1141 | public static extern void GeomSetOffsetWorldRotation(IntPtr geom, ref dReal M00); | ||
1142 | |||
1143 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetPosition"), SuppressUnmanagedCodeSecurity] | ||
1144 | public static extern void GeomSetPosition(IntPtr geom, dReal x, dReal y, dReal z); | ||
1145 | |||
1146 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
1147 | public static extern void GeomSetQuaternion(IntPtr geom, ref Quaternion quat); | ||
1148 | |||
1149 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetQuaternion"), SuppressUnmanagedCodeSecurity] | ||
1150 | public static extern void GeomSetQuaternion(IntPtr geom, ref dReal w); | ||
1151 | |||
1152 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetRotation"), SuppressUnmanagedCodeSecurity] | ||
1153 | public static extern void GeomSetRotation(IntPtr geom, ref Matrix3 R); | ||
1154 | |||
1155 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetRotation"), SuppressUnmanagedCodeSecurity] | ||
1156 | public static extern void GeomSetRotation(IntPtr geom, ref dReal M00); | ||
1157 | |||
1158 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSphereGetRadius"), SuppressUnmanagedCodeSecurity] | ||
1159 | public static extern dReal GeomSphereGetRadius(IntPtr geom); | ||
1160 | |||
1161 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSpherePointDepth"), SuppressUnmanagedCodeSecurity] | ||
1162 | public static extern dReal GeomSpherePointDepth(IntPtr geom, dReal x, dReal y, dReal z); | ||
1163 | |||
1164 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSphereSetRadius"), SuppressUnmanagedCodeSecurity] | ||
1165 | public static extern void GeomSphereSetRadius(IntPtr geom, dReal radius); | ||
1166 | |||
1167 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetCleanup"), SuppressUnmanagedCodeSecurity] | ||
1168 | public static extern int GeomTransformGetCleanup(IntPtr geom); | ||
1169 | |||
1170 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetGeom"), SuppressUnmanagedCodeSecurity] | ||
1171 | public static extern IntPtr GeomTransformGetGeom(IntPtr geom); | ||
1172 | |||
1173 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetInfo"), SuppressUnmanagedCodeSecurity] | ||
1174 | public static extern int GeomTransformGetInfo(IntPtr geom); | ||
1175 | |||
1176 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetCleanup"), SuppressUnmanagedCodeSecurity] | ||
1177 | public static extern void GeomTransformSetCleanup(IntPtr geom, int mode); | ||
1178 | |||
1179 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetGeom"), SuppressUnmanagedCodeSecurity] | ||
1180 | public static extern void GeomTransformSetGeom(IntPtr geom, IntPtr obj); | ||
1181 | |||
1182 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetInfo"), SuppressUnmanagedCodeSecurity] | ||
1183 | public static extern void GeomTransformSetInfo(IntPtr geom, int info); | ||
1184 | |||
1185 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble"), SuppressUnmanagedCodeSecurity] | ||
1186 | public static extern void GeomTriMeshDataBuildDouble(IntPtr d, | ||
1187 | double[] vertices, int vertexStride, int vertexCount, | ||
1188 | int[] indices, int indexCount, int triStride); | ||
1189 | |||
1190 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble"), SuppressUnmanagedCodeSecurity] | ||
1191 | public static extern void GeomTriMeshDataBuildDouble(IntPtr d, | ||
1192 | IntPtr vertices, int vertexStride, int vertexCount, | ||
1193 | IntPtr indices, int indexCount, int triStride); | ||
1194 | |||
1195 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble1"), SuppressUnmanagedCodeSecurity] | ||
1196 | public static extern void GeomTriMeshDataBuildDouble1(IntPtr d, | ||
1197 | double[] vertices, int vertexStride, int vertexCount, | ||
1198 | int[] indices, int indexCount, int triStride, | ||
1199 | double[] normals); | ||
1200 | |||
1201 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble1"), SuppressUnmanagedCodeSecurity] | ||
1202 | public static extern void GeomTriMeshDataBuildDouble(IntPtr d, | ||
1203 | IntPtr vertices, int vertexStride, int vertexCount, | ||
1204 | IntPtr indices, int indexCount, int triStride, | ||
1205 | IntPtr normals); | ||
1206 | |||
1207 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple"), SuppressUnmanagedCodeSecurity] | ||
1208 | public static extern void GeomTriMeshDataBuildSingle(IntPtr d, | ||
1209 | dReal[] vertices, int vertexStride, int vertexCount, | ||
1210 | int[] indices, int indexCount, int triStride); | ||
1211 | |||
1212 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple"), SuppressUnmanagedCodeSecurity] | ||
1213 | public static extern void GeomTriMeshDataBuildSingle(IntPtr d, | ||
1214 | IntPtr vertices, int vertexStride, int vertexCount, | ||
1215 | IntPtr indices, int indexCount, int triStride); | ||
1216 | |||
1217 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple1"), SuppressUnmanagedCodeSecurity] | ||
1218 | public static extern void GeomTriMeshDataBuildSingle1(IntPtr d, | ||
1219 | dReal[] vertices, int vertexStride, int vertexCount, | ||
1220 | int[] indices, int indexCount, int triStride, | ||
1221 | dReal[] normals); | ||
1222 | |||
1223 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple1"), SuppressUnmanagedCodeSecurity] | ||
1224 | public static extern void GeomTriMeshDataBuildSingle1(IntPtr d, | ||
1225 | IntPtr vertices, int vertexStride, int vertexCount, | ||
1226 | IntPtr indices, int indexCount, int triStride, | ||
1227 | IntPtr normals); | ||
1228 | |||
1229 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle"), SuppressUnmanagedCodeSecurity] | ||
1230 | public static extern void GeomTriMeshDataBuildSimple(IntPtr d, | ||
1231 | float[] vertices, int vertexStride, int vertexCount, | ||
1232 | int[] indices, int indexCount, int triStride); | ||
1233 | |||
1234 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle"), SuppressUnmanagedCodeSecurity] | ||
1235 | public static extern void GeomTriMeshDataBuildSimple(IntPtr d, | ||
1236 | IntPtr vertices, int vertexStride, int vertexCount, | ||
1237 | IntPtr indices, int indexCount, int triStride); | ||
1238 | |||
1239 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle1"), SuppressUnmanagedCodeSecurity] | ||
1240 | public static extern void GeomTriMeshDataBuildSimple1(IntPtr d, | ||
1241 | float[] vertices, int vertexStride, int vertexCount, | ||
1242 | int[] indices, int indexCount, int triStride, | ||
1243 | float[] normals); | ||
1244 | |||
1245 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle1"), SuppressUnmanagedCodeSecurity] | ||
1246 | public static extern void GeomTriMeshDataBuildSimple1(IntPtr d, | ||
1247 | IntPtr vertices, int vertexStride, int vertexCount, | ||
1248 | IntPtr indices, int indexCount, int triStride, | ||
1249 | IntPtr normals); | ||
1250 | |||
1251 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshClearTCCache"), SuppressUnmanagedCodeSecurity] | ||
1252 | public static extern void GeomTriMeshClearTCCache(IntPtr g); | ||
1253 | |||
1254 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataCreate"), SuppressUnmanagedCodeSecurity] | ||
1255 | public static extern IntPtr GeomTriMeshDataCreate(); | ||
1256 | |||
1257 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataDestroy"), SuppressUnmanagedCodeSecurity] | ||
1258 | public static extern void GeomTriMeshDataDestroy(IntPtr d); | ||
1259 | |||
1260 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataGet"), SuppressUnmanagedCodeSecurity] | ||
1261 | public static extern IntPtr GeomTriMeshDataGet(IntPtr d, int data_id); | ||
1262 | |||
1263 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataPreprocess"), SuppressUnmanagedCodeSecurity] | ||
1264 | public static extern void GeomTriMeshDataPreprocess(IntPtr d); | ||
1265 | |||
1266 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataSet"), SuppressUnmanagedCodeSecurity] | ||
1267 | public static extern void GeomTriMeshDataSet(IntPtr d, int data_id, IntPtr in_data); | ||
1268 | |||
1269 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataUpdate"), SuppressUnmanagedCodeSecurity] | ||
1270 | public static extern void GeomTriMeshDataUpdate(IntPtr d); | ||
1271 | |||
1272 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshEnableTC"), SuppressUnmanagedCodeSecurity] | ||
1273 | public static extern void GeomTriMeshEnableTC(IntPtr g, int geomClass, bool enable); | ||
1274 | |||
1275 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetArrayCallback"), SuppressUnmanagedCodeSecurity] | ||
1276 | public static extern TriArrayCallback GeomTriMeshGetArrayCallback(IntPtr g); | ||
1277 | |||
1278 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetCallback"), SuppressUnmanagedCodeSecurity] | ||
1279 | public static extern TriCallback GeomTriMeshGetCallback(IntPtr g); | ||
1280 | |||
1281 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetData"), SuppressUnmanagedCodeSecurity] | ||
1282 | public static extern IntPtr GeomTriMeshGetData(IntPtr g); | ||
1283 | |||
1284 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetLastTransform"), SuppressUnmanagedCodeSecurity] | ||
1285 | public extern unsafe static Matrix4* GeomTriMeshGetLastTransformUnsafe(IntPtr geom); | ||
1286 | public static Matrix4 GeomTriMeshGetLastTransform(IntPtr geom) | ||
1287 | { | ||
1288 | unsafe { return *(GeomTriMeshGetLastTransformUnsafe(geom)); } | ||
1289 | } | ||
1290 | |||
1291 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetPoint"), SuppressUnmanagedCodeSecurity] | ||
1292 | public extern static void GeomTriMeshGetPoint(IntPtr g, int index, dReal u, dReal v, ref Vector3 outVec); | ||
1293 | |||
1294 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetRayCallback"), SuppressUnmanagedCodeSecurity] | ||
1295 | public static extern TriRayCallback GeomTriMeshGetRayCallback(IntPtr g); | ||
1296 | |||
1297 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriangle"), SuppressUnmanagedCodeSecurity] | ||
1298 | public extern static void GeomTriMeshGetTriangle(IntPtr g, int index, ref Vector3 v0, ref Vector3 v1, ref Vector3 v2); | ||
1299 | |||
1300 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriangleCount"), SuppressUnmanagedCodeSecurity] | ||
1301 | public extern static int GeomTriMeshGetTriangleCount(IntPtr g); | ||
1302 | |||
1303 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriMeshDataID"), SuppressUnmanagedCodeSecurity] | ||
1304 | public static extern IntPtr GeomTriMeshGetTriMeshDataID(IntPtr g); | ||
1305 | |||
1306 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshIsTCEnabled"), SuppressUnmanagedCodeSecurity] | ||
1307 | public static extern bool GeomTriMeshIsTCEnabled(IntPtr g, int geomClass); | ||
1308 | |||
1309 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetArrayCallback"), SuppressUnmanagedCodeSecurity] | ||
1310 | public static extern void GeomTriMeshSetArrayCallback(IntPtr g, TriArrayCallback arrayCallback); | ||
1311 | |||
1312 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetCallback"), SuppressUnmanagedCodeSecurity] | ||
1313 | public static extern void GeomTriMeshSetCallback(IntPtr g, TriCallback callback); | ||
1314 | |||
1315 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetData"), SuppressUnmanagedCodeSecurity] | ||
1316 | public static extern void GeomTriMeshSetData(IntPtr g, IntPtr data); | ||
1317 | |||
1318 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetLastTransform"), SuppressUnmanagedCodeSecurity] | ||
1319 | public static extern void GeomTriMeshSetLastTransform(IntPtr g, ref Matrix4 last_trans); | ||
1320 | |||
1321 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetLastTransform"), SuppressUnmanagedCodeSecurity] | ||
1322 | public static extern void GeomTriMeshSetLastTransform(IntPtr g, ref dReal M00); | ||
1323 | |||
1324 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetRayCallback"), SuppressUnmanagedCodeSecurity] | ||
1325 | public static extern void GeomTriMeshSetRayCallback(IntPtr g, TriRayCallback callback); | ||
1326 | |||
1327 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGetConfiguration"), SuppressUnmanagedCodeSecurity] | ||
1328 | public static extern IntPtr iGetConfiguration(); | ||
1329 | |||
1330 | public static string GetConfiguration() | ||
1331 | { | ||
1332 | IntPtr ptr = iGetConfiguration(); | ||
1333 | string s = Marshal.PtrToStringAnsi(ptr); | ||
1334 | return s; | ||
1335 | } | ||
1336 | |||
1337 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceCreate"), SuppressUnmanagedCodeSecurity] | ||
1338 | public static extern IntPtr HashSpaceCreate(IntPtr space); | ||
1339 | |||
1340 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceGetLevels"), SuppressUnmanagedCodeSecurity] | ||
1341 | public static extern void HashSpaceGetLevels(IntPtr space, out int minlevel, out int maxlevel); | ||
1342 | |||
1343 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceSetLevels"), SuppressUnmanagedCodeSecurity] | ||
1344 | public static extern void HashSpaceSetLevels(IntPtr space, int minlevel, int maxlevel); | ||
1345 | |||
1346 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInfiniteAABB"), SuppressUnmanagedCodeSecurity] | ||
1347 | public static extern void InfiniteAABB(IntPtr geom, out AABB aabb); | ||
1348 | |||
1349 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInitODE"), SuppressUnmanagedCodeSecurity] | ||
1350 | public static extern void InitODE(); | ||
1351 | |||
1352 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInitODE2"), SuppressUnmanagedCodeSecurity] | ||
1353 | public static extern int InitODE2(uint ODEInitFlags); | ||
1354 | |||
1355 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dIsPositiveDefinite"), SuppressUnmanagedCodeSecurity] | ||
1356 | public static extern int IsPositiveDefinite(ref dReal A, int n); | ||
1357 | |||
1358 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInvertPDMatrix"), SuppressUnmanagedCodeSecurity] | ||
1359 | public static extern int InvertPDMatrix(ref dReal A, out dReal Ainv, int n); | ||
1360 | |||
1361 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddAMotorTorques"), SuppressUnmanagedCodeSecurity] | ||
1362 | public static extern void JointAddAMotorTorques(IntPtr joint, dReal torque1, dReal torque2, dReal torque3); | ||
1363 | |||
1364 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddHingeTorque"), SuppressUnmanagedCodeSecurity] | ||
1365 | public static extern void JointAddHingeTorque(IntPtr joint, dReal torque); | ||
1366 | |||
1367 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddHinge2Torque"), SuppressUnmanagedCodeSecurity] | ||
1368 | public static extern void JointAddHinge2Torques(IntPtr joint, dReal torque1, dReal torque2); | ||
1369 | |||
1370 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddPRTorque"), SuppressUnmanagedCodeSecurity] | ||
1371 | public static extern void JointAddPRTorque(IntPtr joint, dReal torque); | ||
1372 | |||
1373 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddUniversalTorque"), SuppressUnmanagedCodeSecurity] | ||
1374 | public static extern void JointAddUniversalTorques(IntPtr joint, dReal torque1, dReal torque2); | ||
1375 | |||
1376 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddSliderForce"), SuppressUnmanagedCodeSecurity] | ||
1377 | public static extern void JointAddSliderForce(IntPtr joint, dReal force); | ||
1378 | |||
1379 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAttach"), SuppressUnmanagedCodeSecurity] | ||
1380 | public static extern void JointAttach(IntPtr joint, IntPtr body1, IntPtr body2); | ||
1381 | |||
1382 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateAMotor"), SuppressUnmanagedCodeSecurity] | ||
1383 | public static extern IntPtr JointCreateAMotor(IntPtr world, IntPtr group); | ||
1384 | |||
1385 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateBall"), SuppressUnmanagedCodeSecurity] | ||
1386 | public static extern IntPtr JointCreateBall(IntPtr world, IntPtr group); | ||
1387 | |||
1388 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateContact"), SuppressUnmanagedCodeSecurity] | ||
1389 | public static extern IntPtr JointCreateContact(IntPtr world, IntPtr group, ref Contact contact); | ||
1390 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateContact"), SuppressUnmanagedCodeSecurity] | ||
1391 | public static extern IntPtr JointCreateContactPtr(IntPtr world, IntPtr group, IntPtr contact); | ||
1392 | |||
1393 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateFixed"), SuppressUnmanagedCodeSecurity] | ||
1394 | public static extern IntPtr JointCreateFixed(IntPtr world, IntPtr group); | ||
1395 | |||
1396 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateHinge"), SuppressUnmanagedCodeSecurity] | ||
1397 | public static extern IntPtr JointCreateHinge(IntPtr world, IntPtr group); | ||
1398 | |||
1399 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateHinge2"), SuppressUnmanagedCodeSecurity] | ||
1400 | public static extern IntPtr JointCreateHinge2(IntPtr world, IntPtr group); | ||
1401 | |||
1402 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateLMotor"), SuppressUnmanagedCodeSecurity] | ||
1403 | public static extern IntPtr JointCreateLMotor(IntPtr world, IntPtr group); | ||
1404 | |||
1405 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateNull"), SuppressUnmanagedCodeSecurity] | ||
1406 | public static extern IntPtr JointCreateNull(IntPtr world, IntPtr group); | ||
1407 | |||
1408 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreatePR"), SuppressUnmanagedCodeSecurity] | ||
1409 | public static extern IntPtr JointCreatePR(IntPtr world, IntPtr group); | ||
1410 | |||
1411 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreatePlane2D"), SuppressUnmanagedCodeSecurity] | ||
1412 | public static extern IntPtr JointCreatePlane2D(IntPtr world, IntPtr group); | ||
1413 | |||
1414 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateSlider"), SuppressUnmanagedCodeSecurity] | ||
1415 | public static extern IntPtr JointCreateSlider(IntPtr world, IntPtr group); | ||
1416 | |||
1417 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateUniversal"), SuppressUnmanagedCodeSecurity] | ||
1418 | public static extern IntPtr JointCreateUniversal(IntPtr world, IntPtr group); | ||
1419 | |||
1420 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointDestroy"), SuppressUnmanagedCodeSecurity] | ||
1421 | public static extern void JointDestroy(IntPtr j); | ||
1422 | |||
1423 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAngle"), SuppressUnmanagedCodeSecurity] | ||
1424 | public static extern dReal JointGetAMotorAngle(IntPtr j, int anum); | ||
1425 | |||
1426 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAngleRate"), SuppressUnmanagedCodeSecurity] | ||
1427 | public static extern dReal JointGetAMotorAngleRate(IntPtr j, int anum); | ||
1428 | |||
1429 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAxis"), SuppressUnmanagedCodeSecurity] | ||
1430 | public static extern void JointGetAMotorAxis(IntPtr j, int anum, out Vector3 result); | ||
1431 | |||
1432 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAxisRel"), SuppressUnmanagedCodeSecurity] | ||
1433 | public static extern int JointGetAMotorAxisRel(IntPtr j, int anum); | ||
1434 | |||
1435 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorMode"), SuppressUnmanagedCodeSecurity] | ||
1436 | public static extern int JointGetAMotorMode(IntPtr j); | ||
1437 | |||
1438 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorNumAxes"), SuppressUnmanagedCodeSecurity] | ||
1439 | public static extern int JointGetAMotorNumAxes(IntPtr j); | ||
1440 | |||
1441 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorParam"), SuppressUnmanagedCodeSecurity] | ||
1442 | public static extern dReal JointGetAMotorParam(IntPtr j, int parameter); | ||
1443 | |||
1444 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBallAnchor"), SuppressUnmanagedCodeSecurity] | ||
1445 | public static extern void JointGetBallAnchor(IntPtr j, out Vector3 result); | ||
1446 | |||
1447 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBallAnchor2"), SuppressUnmanagedCodeSecurity] | ||
1448 | public static extern void JointGetBallAnchor2(IntPtr j, out Vector3 result); | ||
1449 | |||
1450 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBody"), SuppressUnmanagedCodeSecurity] | ||
1451 | public static extern IntPtr JointGetBody(IntPtr j); | ||
1452 | |||
1453 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetData"), SuppressUnmanagedCodeSecurity] | ||
1454 | public static extern IntPtr JointGetData(IntPtr j); | ||
1455 | |||
1456 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetFeedback"), SuppressUnmanagedCodeSecurity] | ||
1457 | public extern unsafe static JointFeedback* JointGetFeedbackUnsafe(IntPtr j); | ||
1458 | public static JointFeedback JointGetFeedback(IntPtr j) | ||
1459 | { | ||
1460 | unsafe { return *(JointGetFeedbackUnsafe(j)); } | ||
1461 | } | ||
1462 | |||
1463 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAnchor"), SuppressUnmanagedCodeSecurity] | ||
1464 | public static extern void JointGetHingeAnchor(IntPtr j, out Vector3 result); | ||
1465 | |||
1466 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAngle"), SuppressUnmanagedCodeSecurity] | ||
1467 | public static extern dReal JointGetHingeAngle(IntPtr j); | ||
1468 | |||
1469 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAngleRate"), SuppressUnmanagedCodeSecurity] | ||
1470 | public static extern dReal JointGetHingeAngleRate(IntPtr j); | ||
1471 | |||
1472 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAxis"), SuppressUnmanagedCodeSecurity] | ||
1473 | public static extern void JointGetHingeAxis(IntPtr j, out Vector3 result); | ||
1474 | |||
1475 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeParam"), SuppressUnmanagedCodeSecurity] | ||
1476 | public static extern dReal JointGetHingeParam(IntPtr j, int parameter); | ||
1477 | |||
1478 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle1"), SuppressUnmanagedCodeSecurity] | ||
1479 | public static extern dReal JointGetHinge2Angle1(IntPtr j); | ||
1480 | |||
1481 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle1Rate"), SuppressUnmanagedCodeSecurity] | ||
1482 | public static extern dReal JointGetHinge2Angle1Rate(IntPtr j); | ||
1483 | |||
1484 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle2Rate"), SuppressUnmanagedCodeSecurity] | ||
1485 | public static extern dReal JointGetHinge2Angle2Rate(IntPtr j); | ||
1486 | |||
1487 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAnchor2"), SuppressUnmanagedCodeSecurity] | ||
1488 | public static extern void JointGetHingeAnchor2(IntPtr j, out Vector3 result); | ||
1489 | |||
1490 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Anchor"), SuppressUnmanagedCodeSecurity] | ||
1491 | public static extern void JointGetHinge2Anchor(IntPtr j, out Vector3 result); | ||
1492 | |||
1493 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Anchor2"), SuppressUnmanagedCodeSecurity] | ||
1494 | public static extern void JointGetHinge2Anchor2(IntPtr j, out Vector3 result); | ||
1495 | |||
1496 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Axis1"), SuppressUnmanagedCodeSecurity] | ||
1497 | public static extern void JointGetHinge2Axis1(IntPtr j, out Vector3 result); | ||
1498 | |||
1499 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Axis2"), SuppressUnmanagedCodeSecurity] | ||
1500 | public static extern void JointGetHinge2Axis2(IntPtr j, out Vector3 result); | ||
1501 | |||
1502 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Param"), SuppressUnmanagedCodeSecurity] | ||
1503 | public static extern dReal JointGetHinge2Param(IntPtr j, int parameter); | ||
1504 | |||
1505 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorAxis"), SuppressUnmanagedCodeSecurity] | ||
1506 | public static extern void JointGetLMotorAxis(IntPtr j, int anum, out Vector3 result); | ||
1507 | |||
1508 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorNumAxes"), SuppressUnmanagedCodeSecurity] | ||
1509 | public static extern int JointGetLMotorNumAxes(IntPtr j); | ||
1510 | |||
1511 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorParam"), SuppressUnmanagedCodeSecurity] | ||
1512 | public static extern dReal JointGetLMotorParam(IntPtr j, int parameter); | ||
1513 | |||
1514 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAnchor"), SuppressUnmanagedCodeSecurity] | ||
1515 | public static extern void JointGetPRAnchor(IntPtr j, out Vector3 result); | ||
1516 | |||
1517 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAxis1"), SuppressUnmanagedCodeSecurity] | ||
1518 | public static extern void JointGetPRAxis1(IntPtr j, out Vector3 result); | ||
1519 | |||
1520 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAxis2"), SuppressUnmanagedCodeSecurity] | ||
1521 | public static extern void JointGetPRAxis2(IntPtr j, out Vector3 result); | ||
1522 | |||
1523 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRParam"), SuppressUnmanagedCodeSecurity] | ||
1524 | public static extern dReal JointGetPRParam(IntPtr j, int parameter); | ||
1525 | |||
1526 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRPosition"), SuppressUnmanagedCodeSecurity] | ||
1527 | public static extern dReal JointGetPRPosition(IntPtr j); | ||
1528 | |||
1529 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRPositionRate"), SuppressUnmanagedCodeSecurity] | ||
1530 | public static extern dReal JointGetPRPositionRate(IntPtr j); | ||
1531 | |||
1532 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderAxis"), SuppressUnmanagedCodeSecurity] | ||
1533 | public static extern void JointGetSliderAxis(IntPtr j, out Vector3 result); | ||
1534 | |||
1535 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderParam"), SuppressUnmanagedCodeSecurity] | ||
1536 | public static extern dReal JointGetSliderParam(IntPtr j, int parameter); | ||
1537 | |||
1538 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderPosition"), SuppressUnmanagedCodeSecurity] | ||
1539 | public static extern dReal JointGetSliderPosition(IntPtr j); | ||
1540 | |||
1541 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderPositionRate"), SuppressUnmanagedCodeSecurity] | ||
1542 | public static extern dReal JointGetSliderPositionRate(IntPtr j); | ||
1543 | |||
1544 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetType"), SuppressUnmanagedCodeSecurity] | ||
1545 | public static extern JointType JointGetType(IntPtr j); | ||
1546 | |||
1547 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAnchor"), SuppressUnmanagedCodeSecurity] | ||
1548 | public static extern void JointGetUniversalAnchor(IntPtr j, out Vector3 result); | ||
1549 | |||
1550 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAnchor2"), SuppressUnmanagedCodeSecurity] | ||
1551 | public static extern void JointGetUniversalAnchor2(IntPtr j, out Vector3 result); | ||
1552 | |||
1553 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle1"), SuppressUnmanagedCodeSecurity] | ||
1554 | public static extern dReal JointGetUniversalAngle1(IntPtr j); | ||
1555 | |||
1556 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle1Rate"), SuppressUnmanagedCodeSecurity] | ||
1557 | public static extern dReal JointGetUniversalAngle1Rate(IntPtr j); | ||
1558 | |||
1559 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle2"), SuppressUnmanagedCodeSecurity] | ||
1560 | public static extern dReal JointGetUniversalAngle2(IntPtr j); | ||
1561 | |||
1562 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle2Rate"), SuppressUnmanagedCodeSecurity] | ||
1563 | public static extern dReal JointGetUniversalAngle2Rate(IntPtr j); | ||
1564 | |||
1565 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngles"), SuppressUnmanagedCodeSecurity] | ||
1566 | public static extern void JointGetUniversalAngles(IntPtr j, out dReal angle1, out dReal angle2); | ||
1567 | |||
1568 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAxis1"), SuppressUnmanagedCodeSecurity] | ||
1569 | public static extern void JointGetUniversalAxis1(IntPtr j, out Vector3 result); | ||
1570 | |||
1571 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAxis2"), SuppressUnmanagedCodeSecurity] | ||
1572 | public static extern void JointGetUniversalAxis2(IntPtr j, out Vector3 result); | ||
1573 | |||
1574 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalParam"), SuppressUnmanagedCodeSecurity] | ||
1575 | public static extern dReal JointGetUniversalParam(IntPtr j, int parameter); | ||
1576 | |||
1577 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupCreate"), SuppressUnmanagedCodeSecurity] | ||
1578 | public static extern IntPtr JointGroupCreate(int max_size); | ||
1579 | |||
1580 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupDestroy"), SuppressUnmanagedCodeSecurity] | ||
1581 | public static extern void JointGroupDestroy(IntPtr group); | ||
1582 | |||
1583 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupEmpty"), SuppressUnmanagedCodeSecurity] | ||
1584 | public static extern void JointGroupEmpty(IntPtr group); | ||
1585 | |||
1586 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorAngle"), SuppressUnmanagedCodeSecurity] | ||
1587 | public static extern void JointSetAMotorAngle(IntPtr j, int anum, dReal angle); | ||
1588 | |||
1589 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorAxis"), SuppressUnmanagedCodeSecurity] | ||
1590 | public static extern void JointSetAMotorAxis(IntPtr j, int anum, int rel, dReal x, dReal y, dReal z); | ||
1591 | |||
1592 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorMode"), SuppressUnmanagedCodeSecurity] | ||
1593 | public static extern void JointSetAMotorMode(IntPtr j, int mode); | ||
1594 | |||
1595 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorNumAxes"), SuppressUnmanagedCodeSecurity] | ||
1596 | public static extern void JointSetAMotorNumAxes(IntPtr group, int num); | ||
1597 | |||
1598 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorParam"), SuppressUnmanagedCodeSecurity] | ||
1599 | public static extern void JointSetAMotorParam(IntPtr group, int parameter, dReal value); | ||
1600 | |||
1601 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetBallAnchor"), SuppressUnmanagedCodeSecurity] | ||
1602 | public static extern void JointSetBallAnchor(IntPtr j, dReal x, dReal y, dReal z); | ||
1603 | |||
1604 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetBallAnchor2"), SuppressUnmanagedCodeSecurity] | ||
1605 | public static extern void JointSetBallAnchor2(IntPtr j, dReal x, dReal y, dReal z); | ||
1606 | |||
1607 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetData"), SuppressUnmanagedCodeSecurity] | ||
1608 | public static extern void JointSetData(IntPtr j, IntPtr data); | ||
1609 | |||
1610 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetFeedback"), SuppressUnmanagedCodeSecurity] | ||
1611 | public static extern void JointSetFeedback(IntPtr j, out JointFeedback feedback); | ||
1612 | |||
1613 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetFixed"), SuppressUnmanagedCodeSecurity] | ||
1614 | public static extern void JointSetFixed(IntPtr j); | ||
1615 | |||
1616 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAnchor"), SuppressUnmanagedCodeSecurity] | ||
1617 | public static extern void JointSetHingeAnchor(IntPtr j, dReal x, dReal y, dReal z); | ||
1618 | |||
1619 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAnchorDelta"), SuppressUnmanagedCodeSecurity] | ||
1620 | public static extern void JointSetHingeAnchorDelta(IntPtr j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az); | ||
1621 | |||
1622 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAxis"), SuppressUnmanagedCodeSecurity] | ||
1623 | public static extern void JointSetHingeAxis(IntPtr j, dReal x, dReal y, dReal z); | ||
1624 | |||
1625 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeParam"), SuppressUnmanagedCodeSecurity] | ||
1626 | public static extern void JointSetHingeParam(IntPtr j, int parameter, dReal value); | ||
1627 | |||
1628 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Anchor"), SuppressUnmanagedCodeSecurity] | ||
1629 | public static extern void JointSetHinge2Anchor(IntPtr j, dReal x, dReal y, dReal z); | ||
1630 | |||
1631 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Axis1"), SuppressUnmanagedCodeSecurity] | ||
1632 | public static extern void JointSetHinge2Axis1(IntPtr j, dReal x, dReal y, dReal z); | ||
1633 | |||
1634 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Axis2"), SuppressUnmanagedCodeSecurity] | ||
1635 | public static extern void JointSetHinge2Axis2(IntPtr j, dReal x, dReal y, dReal z); | ||
1636 | |||
1637 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Param"), SuppressUnmanagedCodeSecurity] | ||
1638 | public static extern void JointSetHinge2Param(IntPtr j, int parameter, dReal value); | ||
1639 | |||
1640 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorAxis"), SuppressUnmanagedCodeSecurity] | ||
1641 | public static extern void JointSetLMotorAxis(IntPtr j, int anum, int rel, dReal x, dReal y, dReal z); | ||
1642 | |||
1643 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorNumAxes"), SuppressUnmanagedCodeSecurity] | ||
1644 | public static extern void JointSetLMotorNumAxes(IntPtr j, int num); | ||
1645 | |||
1646 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorParam"), SuppressUnmanagedCodeSecurity] | ||
1647 | public static extern void JointSetLMotorParam(IntPtr j, int parameter, dReal value); | ||
1648 | |||
1649 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DAngleParam"), SuppressUnmanagedCodeSecurity] | ||
1650 | public static extern void JointSetPlane2DAngleParam(IntPtr j, int parameter, dReal value); | ||
1651 | |||
1652 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DXParam"), SuppressUnmanagedCodeSecurity] | ||
1653 | public static extern void JointSetPlane2DXParam(IntPtr j, int parameter, dReal value); | ||
1654 | |||
1655 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DYParam"), SuppressUnmanagedCodeSecurity] | ||
1656 | public static extern void JointSetPlane2DYParam(IntPtr j, int parameter, dReal value); | ||
1657 | |||
1658 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAnchor"), SuppressUnmanagedCodeSecurity] | ||
1659 | public static extern void JointSetPRAnchor(IntPtr j, dReal x, dReal y, dReal z); | ||
1660 | |||
1661 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAxis1"), SuppressUnmanagedCodeSecurity] | ||
1662 | public static extern void JointSetPRAxis1(IntPtr j, dReal x, dReal y, dReal z); | ||
1663 | |||
1664 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAxis2"), SuppressUnmanagedCodeSecurity] | ||
1665 | public static extern void JointSetPRAxis2(IntPtr j, dReal x, dReal y, dReal z); | ||
1666 | |||
1667 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRParam"), SuppressUnmanagedCodeSecurity] | ||
1668 | public static extern void JointSetPRParam(IntPtr j, int parameter, dReal value); | ||
1669 | |||
1670 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderAxis"), SuppressUnmanagedCodeSecurity] | ||
1671 | public static extern void JointSetSliderAxis(IntPtr j, dReal x, dReal y, dReal z); | ||
1672 | |||
1673 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderAxisDelta"), SuppressUnmanagedCodeSecurity] | ||
1674 | public static extern void JointSetSliderAxisDelta(IntPtr j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az); | ||
1675 | |||
1676 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderParam"), SuppressUnmanagedCodeSecurity] | ||
1677 | public static extern void JointSetSliderParam(IntPtr j, int parameter, dReal value); | ||
1678 | |||
1679 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAnchor"), SuppressUnmanagedCodeSecurity] | ||
1680 | public static extern void JointSetUniversalAnchor(IntPtr j, dReal x, dReal y, dReal z); | ||
1681 | |||
1682 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAxis1"), SuppressUnmanagedCodeSecurity] | ||
1683 | public static extern void JointSetUniversalAxis1(IntPtr j, dReal x, dReal y, dReal z); | ||
1684 | |||
1685 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAxis2"), SuppressUnmanagedCodeSecurity] | ||
1686 | public static extern void JointSetUniversalAxis2(IntPtr j, dReal x, dReal y, dReal z); | ||
1687 | |||
1688 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalParam"), SuppressUnmanagedCodeSecurity] | ||
1689 | public static extern void JointSetUniversalParam(IntPtr j, int parameter, dReal value); | ||
1690 | |||
1691 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dLDLTAddTL"), SuppressUnmanagedCodeSecurity] | ||
1692 | public static extern void LDLTAddTL(ref dReal L, ref dReal d, ref dReal a, int n, int nskip); | ||
1693 | |||
1694 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassAdd"), SuppressUnmanagedCodeSecurity] | ||
1695 | public static extern void MassAdd(ref Mass a, ref Mass b); | ||
1696 | |||
1697 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassAdjust"), SuppressUnmanagedCodeSecurity] | ||
1698 | public static extern void MassAdjust(ref Mass m, dReal newmass); | ||
1699 | |||
1700 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassCheck"), SuppressUnmanagedCodeSecurity] | ||
1701 | public static extern bool MassCheck(ref Mass m); | ||
1702 | |||
1703 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassRotate"), SuppressUnmanagedCodeSecurity] | ||
1704 | public static extern void MassRotate(ref Mass mass, ref Matrix3 R); | ||
1705 | |||
1706 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassRotate"), SuppressUnmanagedCodeSecurity] | ||
1707 | public static extern void MassRotate(ref Mass mass, ref dReal M00); | ||
1708 | |||
1709 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetBox"), SuppressUnmanagedCodeSecurity] | ||
1710 | public static extern void MassSetBox(out Mass mass, dReal density, dReal lx, dReal ly, dReal lz); | ||
1711 | |||
1712 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetBoxTotal"), SuppressUnmanagedCodeSecurity] | ||
1713 | public static extern void MassSetBoxTotal(out Mass mass, dReal total_mass, dReal lx, dReal ly, dReal lz); | ||
1714 | |||
1715 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCapsule"), SuppressUnmanagedCodeSecurity] | ||
1716 | public static extern void MassSetCapsule(out Mass mass, dReal density, int direction, dReal radius, dReal length); | ||
1717 | |||
1718 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCapsuleTotal"), SuppressUnmanagedCodeSecurity] | ||
1719 | public static extern void MassSetCapsuleTotal(out Mass mass, dReal total_mass, int direction, dReal radius, dReal length); | ||
1720 | |||
1721 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCylinder"), SuppressUnmanagedCodeSecurity] | ||
1722 | public static extern void MassSetCylinder(out Mass mass, dReal density, int direction, dReal radius, dReal length); | ||
1723 | |||
1724 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCylinderTotal"), SuppressUnmanagedCodeSecurity] | ||
1725 | public static extern void MassSetCylinderTotal(out Mass mass, dReal total_mass, int direction, dReal radius, dReal length); | ||
1726 | |||
1727 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetParameters"), SuppressUnmanagedCodeSecurity] | ||
1728 | public static extern void MassSetParameters(out Mass mass, dReal themass, | ||
1729 | dReal cgx, dReal cgy, dReal cgz, | ||
1730 | dReal i11, dReal i22, dReal i33, | ||
1731 | dReal i12, dReal i13, dReal i23); | ||
1732 | |||
1733 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetSphere"), SuppressUnmanagedCodeSecurity] | ||
1734 | public static extern void MassSetSphere(out Mass mass, dReal density, dReal radius); | ||
1735 | |||
1736 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetSphereTotal"), SuppressUnmanagedCodeSecurity] | ||
1737 | public static extern void dMassSetSphereTotal(out Mass mass, dReal total_mass, dReal radius); | ||
1738 | |||
1739 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetTrimesh"), SuppressUnmanagedCodeSecurity] | ||
1740 | public static extern void MassSetTrimesh(out Mass mass, dReal density, IntPtr g); | ||
1741 | |||
1742 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetZero"), SuppressUnmanagedCodeSecurity] | ||
1743 | public static extern void MassSetZero(out Mass mass); | ||
1744 | |||
1745 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassTranslate"), SuppressUnmanagedCodeSecurity] | ||
1746 | public static extern void MassTranslate(ref Mass mass, dReal x, dReal y, dReal z); | ||
1747 | |||
1748 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply0"), SuppressUnmanagedCodeSecurity] | ||
1749 | public static extern void Multiply0(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); | ||
1750 | |||
1751 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply0"), SuppressUnmanagedCodeSecurity] | ||
1752 | private static extern void MultiplyiM3V3(out Vector3 vout, ref Matrix3 matrix, ref Vector3 vect,int p, int q, int r); | ||
1753 | public static void MultiplyM3V3(out Vector3 outvector, ref Matrix3 matrix, ref Vector3 invector) | ||
1754 | { | ||
1755 | MultiplyiM3V3(out outvector, ref matrix, ref invector, 3, 3, 1); | ||
1756 | } | ||
1757 | |||
1758 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply1"), SuppressUnmanagedCodeSecurity] | ||
1759 | public static extern void Multiply1(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); | ||
1760 | |||
1761 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply2"), SuppressUnmanagedCodeSecurity] | ||
1762 | public static extern void Multiply2(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); | ||
1763 | |||
1764 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQFromAxisAndAngle"), SuppressUnmanagedCodeSecurity] | ||
1765 | public static extern void QFromAxisAndAngle(out Quaternion q, dReal ax, dReal ay, dReal az, dReal angle); | ||
1766 | |||
1767 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQfromR"), SuppressUnmanagedCodeSecurity] | ||
1768 | public static extern void QfromR(out Quaternion q, ref Matrix3 R); | ||
1769 | |||
1770 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply0"), SuppressUnmanagedCodeSecurity] | ||
1771 | public static extern void QMultiply0(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); | ||
1772 | |||
1773 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply1"), SuppressUnmanagedCodeSecurity] | ||
1774 | public static extern void QMultiply1(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); | ||
1775 | |||
1776 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply2"), SuppressUnmanagedCodeSecurity] | ||
1777 | public static extern void QMultiply2(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); | ||
1778 | |||
1779 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply3"), SuppressUnmanagedCodeSecurity] | ||
1780 | public static extern void QMultiply3(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); | ||
1781 | |||
1782 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQSetIdentity"), SuppressUnmanagedCodeSecurity] | ||
1783 | public static extern void QSetIdentity(out Quaternion q); | ||
1784 | |||
1785 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQuadTreeSpaceCreate"), SuppressUnmanagedCodeSecurity] | ||
1786 | public static extern IntPtr QuadTreeSpaceCreate(IntPtr space, ref Vector3 center, ref Vector3 extents, int depth); | ||
1787 | |||
1788 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQuadTreeSpaceCreate"), SuppressUnmanagedCodeSecurity] | ||
1789 | public static extern IntPtr QuadTreeSpaceCreate(IntPtr space, ref dReal centerX, ref dReal extentsX, int depth); | ||
1790 | |||
1791 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRandReal"), SuppressUnmanagedCodeSecurity] | ||
1792 | public static extern dReal RandReal(); | ||
1793 | |||
1794 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFrom2Axes"), SuppressUnmanagedCodeSecurity] | ||
1795 | public static extern void RFrom2Axes(out Matrix3 R, dReal ax, dReal ay, dReal az, dReal bx, dReal by, dReal bz); | ||
1796 | |||
1797 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromAxisAndAngle"), SuppressUnmanagedCodeSecurity] | ||
1798 | public static extern void RFromAxisAndAngle(out Matrix3 R, dReal x, dReal y, dReal z, dReal angle); | ||
1799 | |||
1800 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromEulerAngles"), SuppressUnmanagedCodeSecurity] | ||
1801 | public static extern void RFromEulerAngles(out Matrix3 R, dReal phi, dReal theta, dReal psi); | ||
1802 | |||
1803 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRfromQ"), SuppressUnmanagedCodeSecurity] | ||
1804 | public static extern void RfromQ(out Matrix3 R, ref Quaternion q); | ||
1805 | |||
1806 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromZAxis"), SuppressUnmanagedCodeSecurity] | ||
1807 | public static extern void RFromZAxis(out Matrix3 R, dReal ax, dReal ay, dReal az); | ||
1808 | |||
1809 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRSetIdentity"), SuppressUnmanagedCodeSecurity] | ||
1810 | public static extern void RSetIdentity(out Matrix3 R); | ||
1811 | |||
1812 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSetValue"), SuppressUnmanagedCodeSecurity] | ||
1813 | public static extern void SetValue(out dReal a, int n); | ||
1814 | |||
1815 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSetZero"), SuppressUnmanagedCodeSecurity] | ||
1816 | public static extern void SetZero(out dReal a, int n); | ||
1817 | |||
1818 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSimpleSpaceCreate"), SuppressUnmanagedCodeSecurity] | ||
1819 | public static extern IntPtr SimpleSpaceCreate(IntPtr space); | ||
1820 | |||
1821 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveCholesky"), SuppressUnmanagedCodeSecurity] | ||
1822 | public static extern void SolveCholesky(ref dReal L, out dReal b, int n); | ||
1823 | |||
1824 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveL1"), SuppressUnmanagedCodeSecurity] | ||
1825 | public static extern void SolveL1(ref dReal L, out dReal b, int n, int nskip); | ||
1826 | |||
1827 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveL1T"), SuppressUnmanagedCodeSecurity] | ||
1828 | public static extern void SolveL1T(ref dReal L, out dReal b, int n, int nskip); | ||
1829 | |||
1830 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveLDLT"), SuppressUnmanagedCodeSecurity] | ||
1831 | public static extern void SolveLDLT(ref dReal L, ref dReal d, out dReal b, int n, int nskip); | ||
1832 | |||
1833 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceAdd"), SuppressUnmanagedCodeSecurity] | ||
1834 | public static extern void SpaceAdd(IntPtr space, IntPtr geom); | ||
1835 | |||
1836 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceLockQuery"), SuppressUnmanagedCodeSecurity] | ||
1837 | public static extern bool SpaceLockQuery(IntPtr space); | ||
1838 | |||
1839 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceClean"), SuppressUnmanagedCodeSecurity] | ||
1840 | public static extern void SpaceClean(IntPtr space); | ||
1841 | |||
1842 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceCollide"), SuppressUnmanagedCodeSecurity] | ||
1843 | public static extern void SpaceCollide(IntPtr space, IntPtr data, NearCallback callback); | ||
1844 | |||
1845 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceCollide2"), SuppressUnmanagedCodeSecurity] | ||
1846 | public static extern void SpaceCollide2(IntPtr space1, IntPtr space2, IntPtr data, NearCallback callback); | ||
1847 | |||
1848 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceDestroy"), SuppressUnmanagedCodeSecurity] | ||
1849 | public static extern void SpaceDestroy(IntPtr space); | ||
1850 | |||
1851 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetCleanup"), SuppressUnmanagedCodeSecurity] | ||
1852 | public static extern bool SpaceGetCleanup(IntPtr space); | ||
1853 | |||
1854 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetNumGeoms"), SuppressUnmanagedCodeSecurity] | ||
1855 | public static extern int SpaceGetNumGeoms(IntPtr space); | ||
1856 | |||
1857 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetGeom"), SuppressUnmanagedCodeSecurity] | ||
1858 | public static extern IntPtr SpaceGetGeom(IntPtr space, int i); | ||
1859 | |||
1860 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetSublevel"), SuppressUnmanagedCodeSecurity] | ||
1861 | public static extern int SpaceGetSublevel(IntPtr space); | ||
1862 | |||
1863 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceQuery"), SuppressUnmanagedCodeSecurity] | ||
1864 | public static extern bool SpaceQuery(IntPtr space, IntPtr geom); | ||
1865 | |||
1866 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceRemove"), SuppressUnmanagedCodeSecurity] | ||
1867 | public static extern void SpaceRemove(IntPtr space, IntPtr geom); | ||
1868 | |||
1869 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceSetCleanup"), SuppressUnmanagedCodeSecurity] | ||
1870 | public static extern void SpaceSetCleanup(IntPtr space, bool mode); | ||
1871 | |||
1872 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceSetSublevel"), SuppressUnmanagedCodeSecurity] | ||
1873 | public static extern void SpaceSetSublevel(IntPtr space, int sublevel); | ||
1874 | |||
1875 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSweepAndPruneSpaceCreate"), SuppressUnmanagedCodeSecurity] | ||
1876 | public static extern IntPtr SweepAndPruneSpaceCreate(IntPtr space, int AxisOrder); | ||
1877 | |||
1878 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dVectorScale"), SuppressUnmanagedCodeSecurity] | ||
1879 | public static extern void VectorScale(out dReal a, ref dReal d, int n); | ||
1880 | |||
1881 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldCreate"), SuppressUnmanagedCodeSecurity] | ||
1882 | public static extern IntPtr WorldCreate(); | ||
1883 | |||
1884 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldDestroy"), SuppressUnmanagedCodeSecurity] | ||
1885 | public static extern void WorldDestroy(IntPtr world); | ||
1886 | |||
1887 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableAverageSamplesCount"), SuppressUnmanagedCodeSecurity] | ||
1888 | public static extern int WorldGetAutoDisableAverageSamplesCount(IntPtr world); | ||
1889 | |||
1890 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] | ||
1891 | public static extern dReal WorldGetAutoDisableAngularThreshold(IntPtr world); | ||
1892 | |||
1893 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] | ||
1894 | public static extern bool WorldGetAutoDisableFlag(IntPtr world); | ||
1895 | |||
1896 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] | ||
1897 | public static extern dReal WorldGetAutoDisableLinearThreshold(IntPtr world); | ||
1898 | |||
1899 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] | ||
1900 | public static extern int WorldGetAutoDisableSteps(IntPtr world); | ||
1901 | |||
1902 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableTime"), SuppressUnmanagedCodeSecurity] | ||
1903 | public static extern dReal WorldGetAutoDisableTime(IntPtr world); | ||
1904 | |||
1905 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoEnableDepthSF1"), SuppressUnmanagedCodeSecurity] | ||
1906 | public static extern int WorldGetAutoEnableDepthSF1(IntPtr world); | ||
1907 | |||
1908 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetCFM"), SuppressUnmanagedCodeSecurity] | ||
1909 | public static extern dReal WorldGetCFM(IntPtr world); | ||
1910 | |||
1911 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetERP"), SuppressUnmanagedCodeSecurity] | ||
1912 | public static extern dReal WorldGetERP(IntPtr world); | ||
1913 | |||
1914 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetGravity"), SuppressUnmanagedCodeSecurity] | ||
1915 | public static extern void WorldGetGravity(IntPtr world, out Vector3 gravity); | ||
1916 | |||
1917 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetGravity"), SuppressUnmanagedCodeSecurity] | ||
1918 | public static extern void WorldGetGravity(IntPtr world, out dReal X); | ||
1919 | |||
1920 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetContactMaxCorrectingVel"), SuppressUnmanagedCodeSecurity] | ||
1921 | public static extern dReal WorldGetContactMaxCorrectingVel(IntPtr world); | ||
1922 | |||
1923 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetContactSurfaceLayer"), SuppressUnmanagedCodeSecurity] | ||
1924 | public static extern dReal WorldGetContactSurfaceLayer(IntPtr world); | ||
1925 | |||
1926 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAngularDamping"), SuppressUnmanagedCodeSecurity] | ||
1927 | public static extern dReal WorldGetAngularDamping(IntPtr world); | ||
1928 | |||
1929 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] | ||
1930 | public static extern dReal WorldGetAngularDampingThreshold(IntPtr world); | ||
1931 | |||
1932 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetLinearDamping"), SuppressUnmanagedCodeSecurity] | ||
1933 | public static extern dReal WorldGetLinearDamping(IntPtr world); | ||
1934 | |||
1935 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] | ||
1936 | public static extern dReal WorldGetLinearDampingThreshold(IntPtr world); | ||
1937 | |||
1938 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetQuickStepNumIterations"), SuppressUnmanagedCodeSecurity] | ||
1939 | public static extern int WorldGetQuickStepNumIterations(IntPtr world); | ||
1940 | |||
1941 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetQuickStepW"), SuppressUnmanagedCodeSecurity] | ||
1942 | public static extern dReal WorldGetQuickStepW(IntPtr world); | ||
1943 | |||
1944 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetMaxAngularSpeed"), SuppressUnmanagedCodeSecurity] | ||
1945 | public static extern dReal WorldGetMaxAngularSpeed(IntPtr world); | ||
1946 | |||
1947 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldImpulseToForce"), SuppressUnmanagedCodeSecurity] | ||
1948 | public static extern void WorldImpulseToForce(IntPtr world, dReal stepsize, dReal ix, dReal iy, dReal iz, out Vector3 force); | ||
1949 | |||
1950 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldImpulseToForce"), SuppressUnmanagedCodeSecurity] | ||
1951 | public static extern void WorldImpulseToForce(IntPtr world, dReal stepsize, dReal ix, dReal iy, dReal iz, out dReal forceX); | ||
1952 | |||
1953 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldQuickStep"), SuppressUnmanagedCodeSecurity] | ||
1954 | public static extern void WorldQuickStep(IntPtr world, dReal stepsize); | ||
1955 | |||
1956 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAngularDamping"), SuppressUnmanagedCodeSecurity] | ||
1957 | public static extern void WorldSetAngularDamping(IntPtr world, dReal scale); | ||
1958 | |||
1959 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] | ||
1960 | public static extern void WorldSetAngularDampingThreshold(IntPtr world, dReal threshold); | ||
1961 | |||
1962 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] | ||
1963 | public static extern void WorldSetAutoDisableAngularThreshold(IntPtr world, dReal angular_threshold); | ||
1964 | |||
1965 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableAverageSamplesCount"), SuppressUnmanagedCodeSecurity] | ||
1966 | public static extern void WorldSetAutoDisableAverageSamplesCount(IntPtr world, int average_samples_count); | ||
1967 | |||
1968 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] | ||
1969 | public static extern void WorldSetAutoDisableFlag(IntPtr world, bool do_auto_disable); | ||
1970 | |||
1971 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] | ||
1972 | public static extern void WorldSetAutoDisableLinearThreshold(IntPtr world, dReal linear_threshold); | ||
1973 | |||
1974 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] | ||
1975 | public static extern void WorldSetAutoDisableSteps(IntPtr world, int steps); | ||
1976 | |||
1977 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableTime"), SuppressUnmanagedCodeSecurity] | ||
1978 | public static extern void WorldSetAutoDisableTime(IntPtr world, dReal time); | ||
1979 | |||
1980 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoEnableDepthSF1"), SuppressUnmanagedCodeSecurity] | ||
1981 | public static extern void WorldSetAutoEnableDepthSF1(IntPtr world, int autoEnableDepth); | ||
1982 | |||
1983 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetCFM"), SuppressUnmanagedCodeSecurity] | ||
1984 | public static extern void WorldSetCFM(IntPtr world, dReal cfm); | ||
1985 | |||
1986 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetContactMaxCorrectingVel"), SuppressUnmanagedCodeSecurity] | ||
1987 | public static extern void WorldSetContactMaxCorrectingVel(IntPtr world, dReal vel); | ||
1988 | |||
1989 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetContactSurfaceLayer"), SuppressUnmanagedCodeSecurity] | ||
1990 | public static extern void WorldSetContactSurfaceLayer(IntPtr world, dReal depth); | ||
1991 | |||
1992 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetDamping"), SuppressUnmanagedCodeSecurity] | ||
1993 | public static extern void WorldSetDamping(IntPtr world, dReal linear_scale, dReal angular_scale); | ||
1994 | |||
1995 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetERP"), SuppressUnmanagedCodeSecurity] | ||
1996 | public static extern void WorldSetERP(IntPtr world, dReal erp); | ||
1997 | |||
1998 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetGravity"), SuppressUnmanagedCodeSecurity] | ||
1999 | public static extern void WorldSetGravity(IntPtr world, dReal x, dReal y, dReal z); | ||
2000 | |||
2001 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetLinearDamping"), SuppressUnmanagedCodeSecurity] | ||
2002 | public static extern void WorldSetLinearDamping(IntPtr world, dReal scale); | ||
2003 | |||
2004 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] | ||
2005 | public static extern void WorldSetLinearDampingThreshold(IntPtr world, dReal threshold); | ||
2006 | |||
2007 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetQuickStepNumIterations"), SuppressUnmanagedCodeSecurity] | ||
2008 | public static extern void WorldSetQuickStepNumIterations(IntPtr world, int num); | ||
2009 | |||
2010 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetQuickStepW"), SuppressUnmanagedCodeSecurity] | ||
2011 | public static extern void WorldSetQuickStepW(IntPtr world, dReal over_relaxation); | ||
2012 | |||
2013 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetMaxAngularSpeed"), SuppressUnmanagedCodeSecurity] | ||
2014 | public static extern void WorldSetMaxAngularSpeed(IntPtr world, dReal max_speed); | ||
2015 | |||
2016 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldStep"), SuppressUnmanagedCodeSecurity] | ||
2017 | public static extern void WorldStep(IntPtr world, dReal stepsize); | ||
2018 | |||
2019 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldStepFast1"), SuppressUnmanagedCodeSecurity] | ||
2020 | public static extern void WorldStepFast1(IntPtr world, dReal stepsize, int maxiterations); | ||
2021 | |||
2022 | [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldExportDIF"), SuppressUnmanagedCodeSecurity] | ||
2023 | public static extern void WorldExportDIF(IntPtr world, string filename, bool append, string prefix); | ||
2024 | } | ||
2025 | } | ||
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs index b35c299..98bfd1c 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs | |||
@@ -29,7 +29,6 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using Ode.NET; | ||
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
34 | using OpenSim.Region.PhysicsModules.SharedBase; | 33 | using OpenSim.Region.PhysicsModules.SharedBase; |
35 | using log4net; | 34 | using log4net; |
@@ -150,7 +149,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
150 | /// Collision geometry | 149 | /// Collision geometry |
151 | /// </summary> | 150 | /// </summary> |
152 | internal IntPtr Shell { get; private set; } | 151 | internal IntPtr Shell { get; private set; } |
153 | 152 | ||
154 | private IntPtr Amotor = IntPtr.Zero; | 153 | private IntPtr Amotor = IntPtr.Zero; |
155 | private d.Mass ShellMass; | 154 | private d.Mass ShellMass; |
156 | 155 | ||
@@ -238,7 +237,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
238 | m_tainted_isPhysical = true; // new tainted status: need to create ODE information | 237 | m_tainted_isPhysical = true; // new tainted status: need to create ODE information |
239 | 238 | ||
240 | _parent_scene.AddPhysicsActorTaint(this); | 239 | _parent_scene.AddPhysicsActorTaint(this); |
241 | 240 | ||
242 | Name = avName; | 241 | Name = avName; |
243 | } | 242 | } |
244 | 243 | ||
@@ -280,7 +279,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
280 | 279 | ||
281 | public override bool IsPhysical | 280 | public override bool IsPhysical |
282 | { | 281 | { |
283 | get { return false; } | 282 | get { return m_isPhysical; } |
284 | set { return; } | 283 | set { return; } |
285 | } | 284 | } |
286 | 285 | ||
@@ -462,7 +461,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
462 | value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; | 461 | value.Z = _parent_scene.GetTerrainHeightAtXY(127, 127) + 5; |
463 | } | 462 | } |
464 | 463 | ||
465 | m_taintPosition = value; | 464 | m_taintPosition = value; |
466 | _parent_scene.AddPhysicsActorTaint(this); | 465 | _parent_scene.AddPhysicsActorTaint(this); |
467 | } | 466 | } |
468 | else | 467 | else |
@@ -595,7 +594,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
595 | 594 | ||
596 | public override void delink() {} | 595 | public override void delink() {} |
597 | 596 | ||
598 | public override void LockAngularMotion(Vector3 axis) {} | 597 | public override void LockAngularMotion(byte axislocks) {} |
599 | 598 | ||
600 | // This code is very useful. Written by DanX0r. We're just not using it right now. | 599 | // This code is very useful. Written by DanX0r. We're just not using it right now. |
601 | // Commented out to prevent a warning. | 600 | // Commented out to prevent a warning. |
@@ -797,7 +796,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
797 | internal void Move(List<OdeCharacter> defects) | 796 | internal void Move(List<OdeCharacter> defects) |
798 | { | 797 | { |
799 | // no lock; for now it's only called from within Simulate() | 798 | // no lock; for now it's only called from within Simulate() |
800 | 799 | ||
801 | // If the PID Controller isn't active then we set our force | 800 | // If the PID Controller isn't active then we set our force |
802 | // calculating base velocity to the current position | 801 | // calculating base velocity to the current position |
803 | 802 | ||
@@ -812,7 +811,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
812 | 811 | ||
813 | d.Vector3 localpos = d.BodyGetPosition(Body); | 812 | d.Vector3 localpos = d.BodyGetPosition(Body); |
814 | Vector3 localPos = new Vector3(localpos.X, localpos.Y, localpos.Z); | 813 | Vector3 localPos = new Vector3(localpos.X, localpos.Y, localpos.Z); |
815 | 814 | ||
816 | if (!localPos.IsFinite()) | 815 | if (!localPos.IsFinite()) |
817 | { | 816 | { |
818 | m_log.WarnFormat( | 817 | m_log.WarnFormat( |
@@ -1105,8 +1104,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1105 | // lock (OdeScene.UniversalColliderSyncObject) | 1104 | // lock (OdeScene.UniversalColliderSyncObject) |
1106 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); | 1105 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); |
1107 | 1106 | ||
1108 | d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); | 1107 | d.GeomSetCategoryBits(Shell, (uint)m_collisionCategories); |
1109 | d.GeomSetCollideBits(Shell, (int)m_collisionFlags); | 1108 | d.GeomSetCollideBits(Shell, (uint)m_collisionFlags); |
1110 | 1109 | ||
1111 | d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); | 1110 | d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); |
1112 | Body = d.BodyCreate(_parent_scene.world); | 1111 | Body = d.BodyCreate(_parent_scene.world); |
@@ -1249,18 +1248,18 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1249 | } | 1248 | } |
1250 | 1249 | ||
1251 | public override Vector3 PIDTarget { set { return; } } | 1250 | public override Vector3 PIDTarget { set { return; } } |
1252 | public override bool PIDActive | 1251 | public override bool PIDActive |
1253 | { | 1252 | { |
1254 | get { return false; } | 1253 | get { return false; } |
1255 | set { return; } | 1254 | set { return; } |
1256 | } | 1255 | } |
1257 | public override float PIDTau { set { return; } } | 1256 | public override float PIDTau { set { return; } } |
1258 | 1257 | ||
1259 | public override float PIDHoverHeight { set { return; } } | 1258 | public override float PIDHoverHeight { set { return; } } |
1260 | public override bool PIDHoverActive { set { return; } } | 1259 | public override bool PIDHoverActive {get {return false;} set { return; } } |
1261 | public override PIDHoverType PIDHoverType { set { return; } } | 1260 | public override PIDHoverType PIDHoverType { set { return; } } |
1262 | public override float PIDHoverTau { set { return; } } | 1261 | public override float PIDHoverTau { set { return; } } |
1263 | 1262 | ||
1264 | public override Quaternion APIDTarget{ set { return; } } | 1263 | public override Quaternion APIDTarget{ set { return; } } |
1265 | 1264 | ||
1266 | public override bool APIDActive{ set { return; } } | 1265 | public override bool APIDActive{ set { return; } } |
@@ -1291,7 +1290,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1291 | m_eventsubscription = 0; | 1290 | m_eventsubscription = 0; |
1292 | } | 1291 | } |
1293 | 1292 | ||
1294 | internal void AddCollisionEvent(uint CollidedWith, ContactPoint contact) | 1293 | public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) |
1295 | { | 1294 | { |
1296 | if (m_eventsubscription > 0) | 1295 | if (m_eventsubscription > 0) |
1297 | { | 1296 | { |
@@ -1370,7 +1369,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1370 | // m_log.DebugFormat( | 1369 | // m_log.DebugFormat( |
1371 | // "[ODE CHARACTER]: Changing capsule size from {0} to {1} for {2}", | 1370 | // "[ODE CHARACTER]: Changing capsule size from {0} to {1} for {2}", |
1372 | // CAPSULE_LENGTH, m_tainted_CAPSULE_LENGTH, Name); | 1371 | // CAPSULE_LENGTH, m_tainted_CAPSULE_LENGTH, Name); |
1373 | 1372 | ||
1374 | m_pidControllerActive = true; | 1373 | m_pidControllerActive = true; |
1375 | 1374 | ||
1376 | // no lock needed on _parent_scene.OdeLock because we are called from within the thread lock in OdePlugin's simulate() | 1375 | // no lock needed on _parent_scene.OdeLock because we are called from within the thread lock in OdePlugin's simulate() |
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs index 8f8e2bd..7e95d7f 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs | |||
@@ -44,10 +44,10 @@ using System.Reflection; | |||
44 | using System.Runtime.InteropServices; | 44 | using System.Runtime.InteropServices; |
45 | using log4net; | 45 | using log4net; |
46 | using OpenMetaverse; | 46 | using OpenMetaverse; |
47 | using Ode.NET; | ||
48 | using OpenSim.Framework; | 47 | using OpenSim.Framework; |
49 | using OpenSim.Region.PhysicsModules.SharedBase; | 48 | using OpenSim.Region.PhysicsModules.SharedBase; |
50 | 49 | ||
50 | |||
51 | namespace OpenSim.Region.PhysicsModule.ODE | 51 | namespace OpenSim.Region.PhysicsModule.ODE |
52 | { | 52 | { |
53 | public class ODEDynamics | 53 | public class ODEDynamics |
@@ -607,6 +607,13 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
607 | m_body = pBody; | 607 | m_body = pBody; |
608 | } | 608 | } |
609 | 609 | ||
610 | internal void Stop() | ||
611 | { | ||
612 | m_lastLinearVelocityVector = Vector3.Zero; | ||
613 | m_lastAngularVelocity = Vector3.Zero; | ||
614 | m_lastPositionVector = d.BodyGetPosition(Body); | ||
615 | } | ||
616 | |||
610 | internal void Step(float pTimestep, OdeScene pParentScene) | 617 | internal void Step(float pTimestep, OdeScene pParentScene) |
611 | { | 618 | { |
612 | if (m_body == IntPtr.Zero || m_type == Vehicle.TYPE_NONE) | 619 | if (m_body == IntPtr.Zero || m_type == Vehicle.TYPE_NONE) |
@@ -907,7 +914,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
907 | 914 | ||
908 | // Sum velocities | 915 | // Sum velocities |
909 | m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection | 916 | m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection |
910 | 917 | ||
911 | if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) | 918 | if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) |
912 | { | 919 | { |
913 | m_lastAngularVelocity.X = 0; | 920 | m_lastAngularVelocity.X = 0; |
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEModule.cs b/OpenSim/Region/PhysicsModules/Ode/ODEModule.cs new file mode 100644 index 0000000..22fc84d --- /dev/null +++ b/OpenSim/Region/PhysicsModules/Ode/ODEModule.cs | |||
@@ -0,0 +1,89 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using log4net; | ||
4 | using Nini.Config; | ||
5 | using Mono.Addins; | ||
6 | using OpenSim.Framework; | ||
7 | using OpenSim.Region.Framework.Scenes; | ||
8 | using OpenSim.Region.Framework.Interfaces; | ||
9 | |||
10 | namespace OpenSim.Region.PhysicsModule.ODE | ||
11 | { | ||
12 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")] | ||
13 | public class OdeModule : INonSharedRegionModule | ||
14 | { | ||
15 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
16 | |||
17 | private bool m_Enabled = false; | ||
18 | private IConfigSource m_config; | ||
19 | private OdeScene m_scene; | ||
20 | |||
21 | #region INonSharedRegionModule | ||
22 | |||
23 | public string Name | ||
24 | { | ||
25 | get { return "OpenDynamicsEngine"; } | ||
26 | } | ||
27 | |||
28 | public string Version | ||
29 | { | ||
30 | get { return "1.0"; } | ||
31 | } | ||
32 | |||
33 | public Type ReplaceableInterface | ||
34 | { | ||
35 | get { return null; } | ||
36 | } | ||
37 | |||
38 | public void Initialise(IConfigSource source) | ||
39 | { | ||
40 | IConfig config = source.Configs["Startup"]; | ||
41 | if (config != null) | ||
42 | { | ||
43 | string physics = config.GetString("physics", string.Empty); | ||
44 | if (physics == Name) | ||
45 | { | ||
46 | m_config = source; | ||
47 | m_Enabled = true; | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | public void Close() | ||
53 | { | ||
54 | } | ||
55 | |||
56 | public void AddRegion(Scene scene) | ||
57 | { | ||
58 | if (!m_Enabled) | ||
59 | return; | ||
60 | |||
61 | if (Util.IsWindows()) | ||
62 | Util.LoadArchSpecificWindowsDll("ode.dll"); | ||
63 | |||
64 | // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to | ||
65 | // http://opensimulator.org/mantis/view.php?id=2750). | ||
66 | d.InitODE(); | ||
67 | |||
68 | m_scene = new OdeScene(scene, m_config, Name, Version); | ||
69 | } | ||
70 | |||
71 | public void RemoveRegion(Scene scene) | ||
72 | { | ||
73 | if (!m_Enabled || m_scene == null) | ||
74 | return; | ||
75 | |||
76 | m_scene.Dispose(); | ||
77 | m_scene = null; | ||
78 | } | ||
79 | |||
80 | public void RegionLoaded(Scene scene) | ||
81 | { | ||
82 | if (!m_Enabled || m_scene == null) | ||
83 | return; | ||
84 | |||
85 | m_scene.RegionLoaded(); | ||
86 | } | ||
87 | #endregion | ||
88 | } | ||
89 | } | ||
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs index 0b9c45f..8934330 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | |||
@@ -33,7 +33,7 @@ | |||
33 | * ODEDynamics.cs contains methods dealing with Prim Physical motion | 33 | * ODEDynamics.cs contains methods dealing with Prim Physical motion |
34 | * (dynamics) and the associated settings. Old Linear and angular | 34 | * (dynamics) and the associated settings. Old Linear and angular |
35 | * motors for dynamic motion have been replace with MoveLinear() | 35 | * motors for dynamic motion have been replace with MoveLinear() |
36 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic | 36 | * and MoveAngular(); 'Physical' is used only to switch ODE dynamic |
37 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to | 37 | * simualtion on/off; VEHICAL_TYPE_NONE/VEHICAL_TYPE_<other> is to |
38 | * switch between 'VEHICLE' parameter use and general dynamics | 38 | * switch between 'VEHICLE' parameter use and general dynamics |
39 | * settings use. | 39 | * settings use. |
@@ -48,7 +48,6 @@ using System.Runtime.InteropServices; | |||
48 | using System.Threading; | 48 | using System.Threading; |
49 | using log4net; | 49 | using log4net; |
50 | using OpenMetaverse; | 50 | using OpenMetaverse; |
51 | using Ode.NET; | ||
52 | using OpenSim.Framework; | 51 | using OpenSim.Framework; |
53 | using OpenSim.Region.PhysicsModules.SharedBase; | 52 | using OpenSim.Region.PhysicsModules.SharedBase; |
54 | 53 | ||
@@ -83,8 +82,15 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
83 | set | 82 | set |
84 | { | 83 | { |
85 | m_isphysical = value; | 84 | m_isphysical = value; |
86 | if (!m_isphysical) // Zero the remembered last velocity | 85 | if (!m_isphysical) |
86 | { | ||
87 | _zeroFlag = true; // Zero the remembered last velocity | ||
87 | m_lastVelocity = Vector3.Zero; | 88 | m_lastVelocity = Vector3.Zero; |
89 | _acceleration = Vector3.Zero; | ||
90 | _velocity = Vector3.Zero; | ||
91 | m_taintVelocity = Vector3.Zero; | ||
92 | m_rotationalVelocity = Vector3.Zero; | ||
93 | } | ||
88 | } | 94 | } |
89 | } | 95 | } |
90 | 96 | ||
@@ -104,10 +110,12 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
104 | private Vector3 m_taintVelocity; | 110 | private Vector3 m_taintVelocity; |
105 | private Vector3 m_taintTorque; | 111 | private Vector3 m_taintTorque; |
106 | private Quaternion m_taintrot; | 112 | private Quaternion m_taintrot; |
107 | private Vector3 m_angularlock = Vector3.One; | 113 | |
108 | private Vector3 m_taintAngularLock = Vector3.One; | ||
109 | private IntPtr Amotor = IntPtr.Zero; | 114 | private IntPtr Amotor = IntPtr.Zero; |
110 | 115 | ||
116 | private byte m_taintAngularLock = 0; | ||
117 | private byte m_angularlock = 0; | ||
118 | |||
111 | private bool m_assetFailed = false; | 119 | private bool m_assetFailed = false; |
112 | 120 | ||
113 | private Vector3 m_PIDTarget; | 121 | private Vector3 m_PIDTarget; |
@@ -125,7 +133,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
125 | private float m_targetHoverHeight; | 133 | private float m_targetHoverHeight; |
126 | private float m_groundHeight; | 134 | private float m_groundHeight; |
127 | private float m_waterHeight; | 135 | private float m_waterHeight; |
128 | private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 136 | private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. |
129 | 137 | ||
130 | // private float m_tensor = 5f; | 138 | // private float m_tensor = 5f; |
131 | private int body_autodisable_frames = 20; | 139 | private int body_autodisable_frames = 20; |
@@ -162,7 +170,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
162 | 170 | ||
163 | private PrimitiveBaseShape _pbs; | 171 | private PrimitiveBaseShape _pbs; |
164 | private OdeScene _parent_scene; | 172 | private OdeScene _parent_scene; |
165 | 173 | ||
166 | /// <summary> | 174 | /// <summary> |
167 | /// The physics space which contains prim geometries | 175 | /// The physics space which contains prim geometries |
168 | /// </summary> | 176 | /// </summary> |
@@ -195,7 +203,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
195 | public int m_interpenetrationcount { get; private set; } | 203 | public int m_interpenetrationcount { get; private set; } |
196 | internal float m_collisionscore; | 204 | internal float m_collisionscore; |
197 | public int m_roundsUnderMotionThreshold { get; private set; } | 205 | public int m_roundsUnderMotionThreshold { get; private set; } |
198 | private int m_crossingfailures; | ||
199 | 206 | ||
200 | public bool outofBounds { get; private set; } | 207 | public bool outofBounds { get; private set; } |
201 | private float m_density = 10.000006836f; // Aluminum g/cm3; | 208 | private float m_density = 10.000006836f; // Aluminum g/cm3; |
@@ -350,12 +357,12 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
350 | if (m_assetFailed) | 357 | if (m_assetFailed) |
351 | { | 358 | { |
352 | d.GeomSetCategoryBits(prim_geom, 0); | 359 | d.GeomSetCategoryBits(prim_geom, 0); |
353 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); | 360 | d.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits); |
354 | } | 361 | } |
355 | else | 362 | else |
356 | { | 363 | { |
357 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 364 | d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); |
358 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 365 | d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); |
359 | } | 366 | } |
360 | 367 | ||
361 | _parent_scene.geom_name_map[prim_geom] = Name; | 368 | _parent_scene.geom_name_map[prim_geom] = Name; |
@@ -423,7 +430,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
423 | if (m_assetFailed) | 430 | if (m_assetFailed) |
424 | { | 431 | { |
425 | d.GeomSetCategoryBits(prim_geom, 0); | 432 | d.GeomSetCategoryBits(prim_geom, 0); |
426 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); | 433 | d.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits); |
427 | } | 434 | } |
428 | else | 435 | else |
429 | { | 436 | { |
@@ -431,12 +438,12 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
431 | m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); | 438 | m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); |
432 | } | 439 | } |
433 | 440 | ||
434 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 441 | d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); |
435 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 442 | d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); |
436 | 443 | ||
437 | d.BodySetAutoDisableFlag(Body, true); | 444 | d.BodySetAutoDisableFlag(Body, true); |
438 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); | 445 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); |
439 | 446 | ||
440 | // disconnect from world gravity so we can apply buoyancy | 447 | // disconnect from world gravity so we can apply buoyancy |
441 | d.BodySetGravityMode (Body, false); | 448 | d.BodySetGravityMode (Body, false); |
442 | 449 | ||
@@ -445,7 +452,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
445 | m_disabled = false; | 452 | m_disabled = false; |
446 | 453 | ||
447 | // The body doesn't already have a finite rotation mode set here | 454 | // The body doesn't already have a finite rotation mode set here |
448 | if ((!m_angularlock.ApproxEquals(Vector3.One, 0.0f)) && _parent == null) | 455 | if (m_angularlock != 0 && _parent == null) |
449 | { | 456 | { |
450 | createAMotor(m_angularlock); | 457 | createAMotor(m_angularlock); |
451 | } | 458 | } |
@@ -467,8 +474,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
467 | 474 | ||
468 | float returnMass = 0; | 475 | float returnMass = 0; |
469 | float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f; | 476 | float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f; |
470 | float hollowVolume = hollowAmount * hollowAmount; | 477 | float hollowVolume = hollowAmount * hollowAmount; |
471 | 478 | ||
472 | switch (_pbs.ProfileShape) | 479 | switch (_pbs.ProfileShape) |
473 | { | 480 | { |
474 | case ProfileShape.Square: | 481 | case ProfileShape.Square: |
@@ -504,16 +511,16 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
504 | 511 | ||
505 | else if (_pbs.PathCurve == (byte)Extrusion.Curve1) | 512 | else if (_pbs.PathCurve == (byte)Extrusion.Curve1) |
506 | { | 513 | { |
507 | //a tube | 514 | //a tube |
508 | 515 | ||
509 | volume *= 0.78539816339e-2f * (float)(200 - _pbs.PathScaleX); | 516 | volume *= 0.78539816339e-2f * (float)(200 - _pbs.PathScaleX); |
510 | tmp= 1.0f -2.0e-2f * (float)(200 - _pbs.PathScaleY); | 517 | tmp= 1.0f -2.0e-2f * (float)(200 - _pbs.PathScaleY); |
511 | volume -= volume*tmp*tmp; | 518 | volume -= volume*tmp*tmp; |
512 | 519 | ||
513 | if (hollowAmount > 0.0) | 520 | if (hollowAmount > 0.0) |
514 | { | 521 | { |
515 | hollowVolume *= hollowAmount; | 522 | hollowVolume *= hollowAmount; |
516 | 523 | ||
517 | switch (_pbs.HollowShape) | 524 | switch (_pbs.HollowShape) |
518 | { | 525 | { |
519 | case HollowShape.Square: | 526 | case HollowShape.Square: |
@@ -572,7 +579,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
572 | volume *= 0.61685027506808491367715568749226e-2f * (float)(200 - _pbs.PathScaleX); | 579 | volume *= 0.61685027506808491367715568749226e-2f * (float)(200 - _pbs.PathScaleX); |
573 | tmp = 1.0f - .02f * (float)(200 - _pbs.PathScaleY); | 580 | tmp = 1.0f - .02f * (float)(200 - _pbs.PathScaleY); |
574 | volume *= (1.0f - tmp * tmp); | 581 | volume *= (1.0f - tmp * tmp); |
575 | 582 | ||
576 | if (hollowAmount > 0.0) | 583 | if (hollowAmount > 0.0) |
577 | { | 584 | { |
578 | 585 | ||
@@ -816,8 +823,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
816 | } | 823 | } |
817 | else | 824 | else |
818 | { | 825 | { |
819 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 826 | d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); |
820 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 827 | d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); |
821 | } | 828 | } |
822 | 829 | ||
823 | d.BodyDestroy(Body); | 830 | d.BodyDestroy(Body); |
@@ -838,7 +845,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
838 | else | 845 | else |
839 | { | 846 | { |
840 | _parent_scene.DeactivatePrim(this); | 847 | _parent_scene.DeactivatePrim(this); |
841 | 848 | ||
842 | m_collisionCategories &= ~CollisionCategories.Body; | 849 | m_collisionCategories &= ~CollisionCategories.Body; |
843 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 850 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
844 | 851 | ||
@@ -850,8 +857,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
850 | else | 857 | else |
851 | { | 858 | { |
852 | 859 | ||
853 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 860 | d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); |
854 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 861 | d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); |
855 | } | 862 | } |
856 | 863 | ||
857 | Body = IntPtr.Zero; | 864 | Body = IntPtr.Zero; |
@@ -909,7 +916,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
909 | else | 916 | else |
910 | { | 917 | { |
911 | _triMeshData = d.GeomTriMeshDataCreate(); | 918 | _triMeshData = d.GeomTriMeshDataCreate(); |
912 | 919 | ||
913 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); | 920 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); |
914 | d.GeomTriMeshDataPreprocess(_triMeshData); | 921 | d.GeomTriMeshDataPreprocess(_triMeshData); |
915 | m_MeshToTriMeshMap[mesh] = _triMeshData; | 922 | m_MeshToTriMeshMap[mesh] = _triMeshData; |
@@ -919,7 +926,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
919 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | 926 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); |
920 | try | 927 | try |
921 | { | 928 | { |
922 | SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null)); | 929 | SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null)); |
923 | } | 930 | } |
924 | catch (AccessViolationException) | 931 | catch (AccessViolationException) |
925 | { | 932 | { |
@@ -967,7 +974,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
967 | rotate(); | 974 | rotate(); |
968 | } | 975 | } |
969 | } | 976 | } |
970 | 977 | ||
971 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) | 978 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) |
972 | changePhysicsStatus(); | 979 | changePhysicsStatus(); |
973 | 980 | ||
@@ -1001,7 +1008,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1001 | if (m_taintCollidesWater != m_collidesWater) | 1008 | if (m_taintCollidesWater != m_collidesWater) |
1002 | changefloatonwater(); | 1009 | changefloatonwater(); |
1003 | 1010 | ||
1004 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) | 1011 | if (m_taintAngularLock != m_angularlock) |
1005 | changeAngularLock(); | 1012 | changeAngularLock(); |
1006 | } | 1013 | } |
1007 | 1014 | ||
@@ -1017,10 +1024,8 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1017 | //If we have a parent then we're not authorative here | 1024 | //If we have a parent then we're not authorative here |
1018 | if (_parent == null) | 1025 | if (_parent == null) |
1019 | { | 1026 | { |
1020 | if (!m_taintAngularLock.ApproxEquals(Vector3.One, 0f)) | 1027 | if (m_taintAngularLock != 0) |
1021 | { | 1028 | { |
1022 | //d.BodySetFiniteRotationMode(Body, 0); | ||
1023 | //d.BodySetFiniteRotationAxis(Body,m_taintAngularLock.X,m_taintAngularLock.Y,m_taintAngularLock.Z); | ||
1024 | createAMotor(m_taintAngularLock); | 1029 | createAMotor(m_taintAngularLock); |
1025 | } | 1030 | } |
1026 | else | 1031 | else |
@@ -1034,7 +1039,6 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1034 | } | 1039 | } |
1035 | } | 1040 | } |
1036 | 1041 | ||
1037 | // Store this for later in case we get turned into a separate body | ||
1038 | m_angularlock = m_taintAngularLock; | 1042 | m_angularlock = m_taintAngularLock; |
1039 | } | 1043 | } |
1040 | 1044 | ||
@@ -1070,7 +1074,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1070 | else if (_parent != null && m_taintparent == null) | 1074 | else if (_parent != null && m_taintparent == null) |
1071 | { | 1075 | { |
1072 | //Console.WriteLine(" changelink B"); | 1076 | //Console.WriteLine(" changelink B"); |
1073 | 1077 | ||
1074 | if (_parent is OdePrim) | 1078 | if (_parent is OdePrim) |
1075 | { | 1079 | { |
1076 | OdePrim obj = (OdePrim)_parent; | 1080 | OdePrim obj = (OdePrim)_parent; |
@@ -1078,16 +1082,16 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1078 | childPrim = false; | 1082 | childPrim = false; |
1079 | //_parent = null; | 1083 | //_parent = null; |
1080 | } | 1084 | } |
1081 | 1085 | ||
1082 | /* | 1086 | /* |
1083 | if (Body != (IntPtr)0 && _linkJointGroup != (IntPtr)0) | 1087 | if (Body != (IntPtr)0 && _linkJointGroup != (IntPtr)0) |
1084 | d.JointGroupDestroy(_linkJointGroup); | 1088 | d.JointGroupDestroy(_linkJointGroup); |
1085 | 1089 | ||
1086 | _linkJointGroup = (IntPtr)0; | 1090 | _linkJointGroup = (IntPtr)0; |
1087 | m_linkJoint = (IntPtr)0; | 1091 | m_linkJoint = (IntPtr)0; |
1088 | */ | 1092 | */ |
1089 | } | 1093 | } |
1090 | 1094 | ||
1091 | _parent = m_taintparent; | 1095 | _parent = m_taintparent; |
1092 | m_taintPhysics = IsPhysical; | 1096 | m_taintPhysics = IsPhysical; |
1093 | } | 1097 | } |
@@ -1145,12 +1149,12 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1145 | if (prm.m_assetFailed) | 1149 | if (prm.m_assetFailed) |
1146 | { | 1150 | { |
1147 | d.GeomSetCategoryBits(prm.prim_geom, 0); | 1151 | d.GeomSetCategoryBits(prm.prim_geom, 0); |
1148 | d.GeomSetCollideBits(prm.prim_geom, prm.BadMeshAssetCollideBits); | 1152 | d.GeomSetCollideBits(prm.prim_geom, (uint)prm.BadMeshAssetCollideBits); |
1149 | } | 1153 | } |
1150 | else | 1154 | else |
1151 | { | 1155 | { |
1152 | d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); | 1156 | d.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories); |
1153 | d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); | 1157 | d.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags); |
1154 | } | 1158 | } |
1155 | 1159 | ||
1156 | d.Quaternion quat = new d.Quaternion(); | 1160 | d.Quaternion quat = new d.Quaternion(); |
@@ -1194,14 +1198,14 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1194 | if (m_assetFailed) | 1198 | if (m_assetFailed) |
1195 | { | 1199 | { |
1196 | d.GeomSetCategoryBits(prim_geom, 0); | 1200 | d.GeomSetCategoryBits(prim_geom, 0); |
1197 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); | 1201 | d.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits); |
1198 | } | 1202 | } |
1199 | else | 1203 | else |
1200 | { | 1204 | { |
1201 | //Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name); | 1205 | //Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name); |
1202 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 1206 | d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); |
1203 | //Console.WriteLine(" Post GeomSetCategoryBits 2"); | 1207 | //Console.WriteLine(" Post GeomSetCategoryBits 2"); |
1204 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 1208 | d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); |
1205 | } | 1209 | } |
1206 | 1210 | ||
1207 | d.Quaternion quat2 = new d.Quaternion(); | 1211 | d.Quaternion quat2 = new d.Quaternion(); |
@@ -1230,7 +1234,8 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1230 | m_disabled = false; | 1234 | m_disabled = false; |
1231 | 1235 | ||
1232 | // The body doesn't already have a finite rotation mode set here | 1236 | // The body doesn't already have a finite rotation mode set here |
1233 | if ((!m_angularlock.ApproxEquals(Vector3.One, 0f)) && _parent == null) | 1237 | // or remove |
1238 | if (_parent == null) | ||
1234 | { | 1239 | { |
1235 | createAMotor(m_angularlock); | 1240 | createAMotor(m_angularlock); |
1236 | } | 1241 | } |
@@ -1340,7 +1345,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1340 | // in between the disabling and the collision properties setting | 1345 | // in between the disabling and the collision properties setting |
1341 | // which would wake the physical body up from a soft disabling and potentially cause it to fall | 1346 | // which would wake the physical body up from a soft disabling and potentially cause it to fall |
1342 | // through the ground. | 1347 | // through the ground. |
1343 | 1348 | ||
1344 | // NOTE FOR JOINTS: this doesn't always work for jointed assemblies because if you select | 1349 | // NOTE FOR JOINTS: this doesn't always work for jointed assemblies because if you select |
1345 | // just one part of the assembly, the rest of the assembly is non-selected and still simulating, | 1350 | // just one part of the assembly, the rest of the assembly is non-selected and still simulating, |
1346 | // so that causes the selected part to wake up and continue moving. | 1351 | // so that causes the selected part to wake up and continue moving. |
@@ -1354,7 +1359,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1354 | // e.g. we select 100 prims that are connected by joints. non-atomically, the first 50 are | 1359 | // e.g. we select 100 prims that are connected by joints. non-atomically, the first 50 are |
1355 | // selected and disabled. then, due to a thread switch, the selection processing is | 1360 | // selected and disabled. then, due to a thread switch, the selection processing is |
1356 | // interrupted and the physics engine continues to simulate, so the last 50 items, whose | 1361 | // interrupted and the physics engine continues to simulate, so the last 50 items, whose |
1357 | // selection was not yet processed, continues to simulate. this wakes up ALL of the | 1362 | // selection was not yet processed, continues to simulate. this wakes up ALL of the |
1358 | // first 50 again. then the last 50 are disabled. then the first 50, which were just woken | 1363 | // first 50 again. then the last 50 are disabled. then the first 50, which were just woken |
1359 | // up, start simulating again, which in turn wakes up the last 50. | 1364 | // up, start simulating again, which in turn wakes up the last 50. |
1360 | 1365 | ||
@@ -1370,8 +1375,8 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1370 | } | 1375 | } |
1371 | else | 1376 | else |
1372 | { | 1377 | { |
1373 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 1378 | d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); |
1374 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 1379 | d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); |
1375 | } | 1380 | } |
1376 | 1381 | ||
1377 | if (IsPhysical) | 1382 | if (IsPhysical) |
@@ -1396,12 +1401,12 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1396 | if (m_assetFailed) | 1401 | if (m_assetFailed) |
1397 | { | 1402 | { |
1398 | d.GeomSetCategoryBits(prim_geom, 0); | 1403 | d.GeomSetCategoryBits(prim_geom, 0); |
1399 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); | 1404 | d.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits); |
1400 | } | 1405 | } |
1401 | else | 1406 | else |
1402 | { | 1407 | { |
1403 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 1408 | d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); |
1404 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 1409 | d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); |
1405 | } | 1410 | } |
1406 | 1411 | ||
1407 | if (IsPhysical) | 1412 | if (IsPhysical) |
@@ -1560,7 +1565,7 @@ Console.WriteLine("CreateGeom:"); | |||
1560 | private void changeadd() | 1565 | private void changeadd() |
1561 | { | 1566 | { |
1562 | // m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name); | 1567 | // m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name); |
1563 | 1568 | ||
1564 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); | 1569 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); |
1565 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); | 1570 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); |
1566 | 1571 | ||
@@ -1686,6 +1691,9 @@ Console.WriteLine(" JointCreateFixed"); | |||
1686 | float fy = 0; | 1691 | float fy = 0; |
1687 | float fz = 0; | 1692 | float fz = 0; |
1688 | 1693 | ||
1694 | if (outofBounds) | ||
1695 | return; | ||
1696 | |||
1689 | if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim) // KF: Only move root prims. | 1697 | if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim) // KF: Only move root prims. |
1690 | { | 1698 | { |
1691 | if (m_vehicle.Type != Vehicle.TYPE_NONE) | 1699 | if (m_vehicle.Type != Vehicle.TYPE_NONE) |
@@ -1697,31 +1705,16 @@ Console.WriteLine(" JointCreateFixed"); | |||
1697 | { | 1705 | { |
1698 | //Console.WriteLine("Move " + Name); | 1706 | //Console.WriteLine("Move " + Name); |
1699 | if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 | 1707 | if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 |
1700 | // NON-'VEHICLES' are dealt with here | ||
1701 | // if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) | ||
1702 | // { | ||
1703 | // d.Vector3 avel2 = d.BodyGetAngularVel(Body); | ||
1704 | // /* | ||
1705 | // if (m_angularlock.X == 1) | ||
1706 | // avel2.X = 0; | ||
1707 | // if (m_angularlock.Y == 1) | ||
1708 | // avel2.Y = 0; | ||
1709 | // if (m_angularlock.Z == 1) | ||
1710 | // avel2.Z = 0; | ||
1711 | // d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z); | ||
1712 | // */ | ||
1713 | // } | ||
1714 | //float PID_P = 900.0f; | ||
1715 | 1708 | ||
1716 | float m_mass = CalculateMass(); | 1709 | float m_mass = CalculateMass(); |
1717 | 1710 | ||
1718 | // fz = 0f; | 1711 | // fz = 0f; |
1719 | //m_log.Info(m_collisionFlags.ToString()); | 1712 | //m_log.Info(m_collisionFlags.ToString()); |
1720 | 1713 | ||
1721 | 1714 | ||
1722 | //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. | 1715 | //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle. |
1723 | // would come from SceneObjectPart.cs, public void SetBuoyancy(float fvalue) , PhysActor.Buoyancy = fvalue; ?? | 1716 | // would come from SceneObjectPart.cs, public void SetBuoyancy(float fvalue) , PhysActor.Buoyancy = fvalue; ?? |
1724 | // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up | 1717 | // m_buoyancy: (unlimited value) <0=Falls fast; 0=1g; 1=0g; >1 = floats up |
1725 | // gravityz multiplier = 1 - m_buoyancy | 1718 | // gravityz multiplier = 1 - m_buoyancy |
1726 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; | 1719 | fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; |
1727 | 1720 | ||
@@ -1736,7 +1729,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1736 | fz = 0f; | 1729 | fz = 0f; |
1737 | 1730 | ||
1738 | // no lock; for now it's only called from within Simulate() | 1731 | // no lock; for now it's only called from within Simulate() |
1739 | 1732 | ||
1740 | // If the PID Controller isn't active then we set our force | 1733 | // If the PID Controller isn't active then we set our force |
1741 | // calculating base velocity to the current position | 1734 | // calculating base velocity to the current position |
1742 | 1735 | ||
@@ -1745,7 +1738,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1745 | //PID_G = PID_G / m_PIDTau; | 1738 | //PID_G = PID_G / m_PIDTau; |
1746 | m_PIDTau = 1; | 1739 | m_PIDTau = 1; |
1747 | } | 1740 | } |
1748 | 1741 | ||
1749 | if ((PID_G - m_PIDTau) <= 0) | 1742 | if ((PID_G - m_PIDTau) <= 0) |
1750 | { | 1743 | { |
1751 | PID_G = m_PIDTau + 1; | 1744 | PID_G = m_PIDTau + 1; |
@@ -1768,7 +1761,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1768 | if (_target_velocity.ApproxEquals(Vector3.Zero,0.1f)) | 1761 | if (_target_velocity.ApproxEquals(Vector3.Zero,0.1f)) |
1769 | { | 1762 | { |
1770 | // keep track of where we stopped. No more slippin' & slidin' | 1763 | // keep track of where we stopped. No more slippin' & slidin' |
1771 | 1764 | ||
1772 | // We only want to deactivate the PID Controller if we think we want to have our surrogate | 1765 | // We only want to deactivate the PID Controller if we think we want to have our surrogate |
1773 | // react to the physics scene by moving it's position. | 1766 | // react to the physics scene by moving it's position. |
1774 | // Avatar to Avatar collisions | 1767 | // Avatar to Avatar collisions |
@@ -1789,7 +1782,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1789 | // We're flying and colliding with something | 1782 | // We're flying and colliding with something |
1790 | fx = ((_target_velocity.X) - vel.X) * (PID_D); | 1783 | fx = ((_target_velocity.X) - vel.X) * (PID_D); |
1791 | fy = ((_target_velocity.Y) - vel.Y) * (PID_D); | 1784 | fy = ((_target_velocity.Y) - vel.Y) * (PID_D); |
1792 | 1785 | ||
1793 | // vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; | 1786 | // vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; |
1794 | 1787 | ||
1795 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); | 1788 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); |
@@ -1800,7 +1793,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1800 | if (m_useHoverPID && !PIDActive) | 1793 | if (m_useHoverPID && !PIDActive) |
1801 | { | 1794 | { |
1802 | //Console.WriteLine("Hover " + Name); | 1795 | //Console.WriteLine("Hover " + Name); |
1803 | 1796 | ||
1804 | // If we're using the PID controller, then we have no gravity | 1797 | // If we're using the PID controller, then we have no gravity |
1805 | fz = (-1 * _parent_scene.gravityz) * m_mass; | 1798 | fz = (-1 * _parent_scene.gravityz) * m_mass; |
1806 | 1799 | ||
@@ -1857,7 +1850,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1857 | if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) | 1850 | if (_target_velocity.ApproxEquals(Vector3.Zero, 0.1f)) |
1858 | { | 1851 | { |
1859 | // keep track of where we stopped. No more slippin' & slidin' | 1852 | // keep track of where we stopped. No more slippin' & slidin' |
1860 | 1853 | ||
1861 | // We only want to deactivate the PID Controller if we think we want to have our surrogate | 1854 | // We only want to deactivate the PID Controller if we think we want to have our surrogate |
1862 | // react to the physics scene by moving it's position. | 1855 | // react to the physics scene by moving it's position. |
1863 | // Avatar to Avatar collisions | 1856 | // Avatar to Avatar collisions |
@@ -1895,7 +1888,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1895 | { | 1888 | { |
1896 | // A physical body at rest on a surface will auto-disable after a while, | 1889 | // A physical body at rest on a surface will auto-disable after a while, |
1897 | // this appears to re-enable it incase the surface it is upon vanishes, | 1890 | // this appears to re-enable it incase the surface it is upon vanishes, |
1898 | // and the body should fall again. | 1891 | // and the body should fall again. |
1899 | d.BodySetLinearVel(Body, 0f, 0f, 0f); | 1892 | d.BodySetLinearVel(Body, 0f, 0f, 0f); |
1900 | d.BodySetForce(Body, 0, 0, 0); | 1893 | d.BodySetForce(Body, 0, 0, 0); |
1901 | enableBodySoft(); | 1894 | enableBodySoft(); |
@@ -1904,7 +1897,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1904 | // 35x10 = 350n times the mass per second applied maximum. | 1897 | // 35x10 = 350n times the mass per second applied maximum. |
1905 | float nmax = 35f * m_mass; | 1898 | float nmax = 35f * m_mass; |
1906 | float nmin = -35f * m_mass; | 1899 | float nmin = -35f * m_mass; |
1907 | 1900 | ||
1908 | if (fx > nmax) | 1901 | if (fx > nmax) |
1909 | fx = nmax; | 1902 | fx = nmax; |
1910 | if (fx < nmin) | 1903 | if (fx < nmin) |
@@ -1923,7 +1916,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1923 | // _zeroPosition = d.BodyGetPosition(Body); | 1916 | // _zeroPosition = d.BodyGetPosition(Body); |
1924 | return; | 1917 | return; |
1925 | //Console.WriteLine("Nothing " + Name); | 1918 | //Console.WriteLine("Nothing " + Name); |
1926 | 1919 | ||
1927 | } | 1920 | } |
1928 | } | 1921 | } |
1929 | 1922 | ||
@@ -1940,8 +1933,8 @@ Console.WriteLine(" JointCreateFixed"); | |||
1940 | d.BodySetQuaternion(Body, ref myrot); | 1933 | d.BodySetQuaternion(Body, ref myrot); |
1941 | if (IsPhysical) | 1934 | if (IsPhysical) |
1942 | { | 1935 | { |
1943 | if (!m_angularlock.ApproxEquals(Vector3.One, 0f)) | 1936 | // create or remove locks |
1944 | createAMotor(m_angularlock); | 1937 | createAMotor(m_angularlock); |
1945 | } | 1938 | } |
1946 | } | 1939 | } |
1947 | else | 1940 | else |
@@ -1949,7 +1942,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
1949 | // daughter prim, do Geom set | 1942 | // daughter prim, do Geom set |
1950 | d.GeomSetQuaternion(prim_geom, ref myrot); | 1943 | d.GeomSetQuaternion(prim_geom, ref myrot); |
1951 | } | 1944 | } |
1952 | 1945 | ||
1953 | resetCollisionAccounting(); | 1946 | resetCollisionAccounting(); |
1954 | m_taintrot = _orientation; | 1947 | m_taintrot = _orientation; |
1955 | } | 1948 | } |
@@ -2087,7 +2080,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2087 | else | 2080 | else |
2088 | m_assetFailed = false; | 2081 | m_assetFailed = false; |
2089 | } | 2082 | } |
2090 | 2083 | ||
2091 | } | 2084 | } |
2092 | 2085 | ||
2093 | CreateGeom(m_targetSpace, mesh); | 2086 | CreateGeom(m_targetSpace, mesh); |
@@ -2140,10 +2133,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2140 | } | 2133 | } |
2141 | 2134 | ||
2142 | if (m_assetFailed) | 2135 | if (m_assetFailed) |
2143 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); | 2136 | d.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits); |
2144 | else | 2137 | else |
2145 | 2138 | ||
2146 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 2139 | d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); |
2147 | } | 2140 | } |
2148 | /// <summary> | 2141 | /// <summary> |
2149 | /// Change prim in response to a shape taint. | 2142 | /// Change prim in response to a shape taint. |
@@ -2319,7 +2312,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2319 | } | 2312 | } |
2320 | d.BodyEnable(Body); | 2313 | d.BodyEnable(Body); |
2321 | d.BodyAddTorque(Body, iforce.X, iforce.Y, iforce.Z); | 2314 | d.BodyAddTorque(Body, iforce.X, iforce.Y, iforce.Z); |
2322 | 2315 | ||
2323 | } | 2316 | } |
2324 | m_angularforcelist.Clear(); | 2317 | m_angularforcelist.Clear(); |
2325 | } | 2318 | } |
@@ -2349,7 +2342,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2349 | d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); | 2342 | d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); |
2350 | } | 2343 | } |
2351 | } | 2344 | } |
2352 | 2345 | ||
2353 | //resetCollisionAccounting(); | 2346 | //resetCollisionAccounting(); |
2354 | } | 2347 | } |
2355 | 2348 | ||
@@ -2659,16 +2652,46 @@ Console.WriteLine(" JointCreateFixed"); | |||
2659 | 2652 | ||
2660 | public override void CrossingFailure() | 2653 | public override void CrossingFailure() |
2661 | { | 2654 | { |
2662 | m_crossingfailures++; | 2655 | /* |
2663 | if (m_crossingfailures > _parent_scene.geomCrossingFailuresBeforeOutofbounds) | 2656 | m_crossingfailures++; |
2664 | { | 2657 | if (m_crossingfailures > _parent_scene.geomCrossingFailuresBeforeOutofbounds) |
2665 | base.RaiseOutOfBounds(_position); | 2658 | { |
2666 | return; | 2659 | base.RaiseOutOfBounds(_position); |
2667 | } | 2660 | return; |
2668 | else if (m_crossingfailures == _parent_scene.geomCrossingFailuresBeforeOutofbounds) | 2661 | } |
2662 | else if (m_crossingfailures == _parent_scene.geomCrossingFailuresBeforeOutofbounds) | ||
2663 | { | ||
2664 | m_log.Warn("[PHYSICS]: Too many crossing failures for: " + Name); | ||
2665 | } | ||
2666 | */ | ||
2667 | |||
2668 | d.AllocateODEDataForThread(0U); | ||
2669 | |||
2670 | _position.X = Util.Clip(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f); | ||
2671 | _position.Y = Util.Clip(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f); | ||
2672 | _position.Z = Util.Clip(_position.Z + 0.2f, -100f, 50000f); | ||
2673 | |||
2674 | m_lastposition = _position; | ||
2675 | _velocity.X = 0; | ||
2676 | _velocity.Y = 0; | ||
2677 | _velocity.Z = 0; | ||
2678 | |||
2679 | m_lastVelocity = _velocity; | ||
2680 | |||
2681 | if (Body != IntPtr.Zero) | ||
2669 | { | 2682 | { |
2670 | m_log.Warn("[PHYSICS]: Too many crossing failures for: " + Name); | 2683 | d.BodySetLinearVel(Body, 0, 0, 0); // stop it |
2684 | d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); | ||
2671 | } | 2685 | } |
2686 | |||
2687 | if(m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) | ||
2688 | m_vehicle.Stop(); // this also updates vehicle last position from the body position | ||
2689 | |||
2690 | enableBodySoft(); | ||
2691 | |||
2692 | outofBounds = false; | ||
2693 | base.RequestPhysicsterseUpdate(); | ||
2694 | |||
2672 | } | 2695 | } |
2673 | 2696 | ||
2674 | public override float Buoyancy | 2697 | public override float Buoyancy |
@@ -2687,32 +2710,23 @@ Console.WriteLine(" JointCreateFixed"); | |||
2687 | m_taintparent = null; | 2710 | m_taintparent = null; |
2688 | } | 2711 | } |
2689 | 2712 | ||
2690 | public override void LockAngularMotion(Vector3 axis) | 2713 | public override void LockAngularMotion(byte axislocks) |
2691 | { | 2714 | { |
2692 | // reverse the zero/non zero values for ODE. | 2715 | // m_log.DebugFormat("[axislocks]: {0}", axislocks); |
2693 | if (axis.IsFinite()) | 2716 | m_taintAngularLock = axislocks; |
2694 | { | ||
2695 | axis.X = (axis.X > 0) ? 1f : 0f; | ||
2696 | axis.Y = (axis.Y > 0) ? 1f : 0f; | ||
2697 | axis.Z = (axis.Z > 0) ? 1f : 0f; | ||
2698 | m_log.DebugFormat("[axislock]: <{0},{1},{2}>", axis.X, axis.Y, axis.Z); | ||
2699 | m_taintAngularLock = axis; | ||
2700 | } | ||
2701 | else | ||
2702 | { | ||
2703 | m_log.WarnFormat("[PHYSICS]: Got NaN locking axis from Scene on Object {0}", Name); | ||
2704 | } | ||
2705 | } | 2717 | } |
2706 | 2718 | ||
2707 | internal void UpdatePositionAndVelocity() | 2719 | internal void UpdatePositionAndVelocity() |
2708 | { | 2720 | { |
2709 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 2721 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
2722 | if (outofBounds) | ||
2723 | return; | ||
2710 | if (_parent == null) | 2724 | if (_parent == null) |
2711 | { | 2725 | { |
2712 | Vector3 pv = Vector3.Zero; | 2726 | Vector3 pv = Vector3.Zero; |
2713 | bool lastZeroFlag = _zeroFlag; | 2727 | bool lastZeroFlag = _zeroFlag; |
2714 | float m_minvelocity = 0; | 2728 | float m_minvelocity = 0; |
2715 | if (Body != (IntPtr)0) // FIXME -> or if it is a joint | 2729 | if (Body != IntPtr.Zero) // FIXME -> or if it is a joint |
2716 | { | 2730 | { |
2717 | d.Vector3 vec = d.BodyGetPosition(Body); | 2731 | d.Vector3 vec = d.BodyGetPosition(Body); |
2718 | d.Quaternion ori = d.BodyGetQuaternion(Body); | 2732 | d.Quaternion ori = d.BodyGetQuaternion(Body); |
@@ -2723,12 +2737,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
2723 | Vector3 l_position = Vector3.Zero; | 2737 | Vector3 l_position = Vector3.Zero; |
2724 | Quaternion l_orientation = Quaternion.Identity; | 2738 | Quaternion l_orientation = Quaternion.Identity; |
2725 | 2739 | ||
2726 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | ||
2727 | //if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | ||
2728 | //if (vec.Y < 0.0f) { vec.Y = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | ||
2729 | //if (vec.X > 255.95f) { vec.X = 255.95f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | ||
2730 | //if (vec.Y > 255.95f) { vec.Y = 255.95f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } | ||
2731 | |||
2732 | m_lastposition = _position; | 2740 | m_lastposition = _position; |
2733 | m_lastorientation = _orientation; | 2741 | m_lastorientation = _orientation; |
2734 | 2742 | ||
@@ -2740,26 +2748,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
2740 | l_orientation.Z = ori.Z; | 2748 | l_orientation.Z = ori.Z; |
2741 | l_orientation.W = ori.W; | 2749 | l_orientation.W = ori.W; |
2742 | 2750 | ||
2743 | if (l_position.X > ((int)_parent_scene.WorldExtents.X - 0.05f) || l_position.X < 0f || l_position.Y > ((int)_parent_scene.WorldExtents.Y - 0.05f) || l_position.Y < 0f) | ||
2744 | { | ||
2745 | //base.RaiseOutOfBounds(l_position); | ||
2746 | |||
2747 | if (m_crossingfailures < _parent_scene.geomCrossingFailuresBeforeOutofbounds) | ||
2748 | { | ||
2749 | _position = l_position; | ||
2750 | //_parent_scene.remActivePrim(this); | ||
2751 | if (_parent == null) | ||
2752 | base.RequestPhysicsterseUpdate(); | ||
2753 | return; | ||
2754 | } | ||
2755 | else | ||
2756 | { | ||
2757 | if (_parent == null) | ||
2758 | base.RaiseOutOfBounds(l_position); | ||
2759 | return; | ||
2760 | } | ||
2761 | } | ||
2762 | |||
2763 | if (l_position.Z < 0) | 2751 | if (l_position.Z < 0) |
2764 | { | 2752 | { |
2765 | // This is so prim that get lost underground don't fall forever and suck up | 2753 | // This is so prim that get lost underground don't fall forever and suck up |
@@ -2769,8 +2757,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
2769 | // It's a hack and will generate a console message if it fails. | 2757 | // It's a hack and will generate a console message if it fails. |
2770 | 2758 | ||
2771 | //IsPhysical = false; | 2759 | //IsPhysical = false; |
2772 | if (_parent == null) | ||
2773 | base.RaiseOutOfBounds(_position); | ||
2774 | 2760 | ||
2775 | _acceleration.X = 0; | 2761 | _acceleration.X = 0; |
2776 | _acceleration.Y = 0; | 2762 | _acceleration.Y = 0; |
@@ -2784,16 +2770,65 @@ Console.WriteLine(" JointCreateFixed"); | |||
2784 | m_rotationalVelocity.Z = 0; | 2770 | m_rotationalVelocity.Z = 0; |
2785 | 2771 | ||
2786 | if (_parent == null) | 2772 | if (_parent == null) |
2773 | base.RaiseOutOfBounds(_position); | ||
2774 | |||
2775 | if (_parent == null) | ||
2787 | base.RequestPhysicsterseUpdate(); | 2776 | base.RequestPhysicsterseUpdate(); |
2788 | 2777 | ||
2789 | m_throttleUpdates = false; | 2778 | m_throttleUpdates = false; |
2790 | throttleCounter = 0; | 2779 | throttleCounter = 0; |
2791 | _zeroFlag = true; | 2780 | _zeroFlag = true; |
2792 | //outofBounds = true; | 2781 | //outofBounds = true; |
2782 | return; | ||
2783 | } | ||
2784 | |||
2785 | if (l_position.X > ((int)_parent_scene.WorldExtents.X - 0.05f) || l_position.X < 0f || l_position.Y > ((int)_parent_scene.WorldExtents.Y - 0.05f) || l_position.Y < 0f) | ||
2786 | { | ||
2787 | //base.RaiseOutOfBounds(l_position); | ||
2788 | /* | ||
2789 | if (m_crossingfailures < _parent_scene.geomCrossingFailuresBeforeOutofbounds) | ||
2790 | { | ||
2791 | _position = l_position; | ||
2792 | //_parent_scene.remActivePrim(this); | ||
2793 | if (_parent == null) | ||
2794 | base.RequestPhysicsterseUpdate(); | ||
2795 | return; | ||
2796 | } | ||
2797 | else | ||
2798 | { | ||
2799 | if (_parent == null) | ||
2800 | base.RaiseOutOfBounds(l_position); | ||
2801 | return; | ||
2802 | } | ||
2803 | */ | ||
2804 | outofBounds = true; | ||
2805 | // part near the border on outside | ||
2806 | if (l_position.X < 0) | ||
2807 | Util.Clamp(l_position.X, -0.1f, -2f); | ||
2808 | else | ||
2809 | Util.Clamp(l_position.X, _parent_scene.WorldExtents.X + 0.1f, _parent_scene.WorldExtents.X + 2f); | ||
2810 | if (l_position.Y < 0) | ||
2811 | Util.Clamp(l_position.Y, -0.1f, -2f); | ||
2812 | else | ||
2813 | Util.Clamp(l_position.Y, _parent_scene.WorldExtents.Y + 0.1f, _parent_scene.WorldExtents.Y + 2f); | ||
2814 | |||
2815 | d.BodySetPosition(Body, l_position.X, l_position.Y, l_position.Z); | ||
2816 | |||
2817 | // stop it | ||
2818 | d.BodySetAngularVel(Body, 0, 0, 0); | ||
2819 | d.BodySetLinearVel(Body, 0, 0, 0); | ||
2820 | disableBodySoft(); | ||
2821 | |||
2822 | _position = l_position; | ||
2823 | // tell framework to fix it | ||
2824 | if (_parent == null) | ||
2825 | base.RequestPhysicsterseUpdate(); | ||
2826 | return; | ||
2793 | } | 2827 | } |
2794 | 2828 | ||
2829 | |||
2795 | //float Adiff = 1.0f - Math.Abs(Quaternion.Dot(m_lastorientation, l_orientation)); | 2830 | //float Adiff = 1.0f - Math.Abs(Quaternion.Dot(m_lastorientation, l_orientation)); |
2796 | //Console.WriteLine("Adiff " + Name + " = " + Adiff); | 2831 | //Console.WriteLine("Adiff " + Name + " = " + Adiff); |
2797 | if ((Math.Abs(m_lastposition.X - l_position.X) < 0.02) | 2832 | if ((Math.Abs(m_lastposition.X - l_position.X) < 0.02) |
2798 | && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02) | 2833 | && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02) |
2799 | && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02) | 2834 | && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02) |
@@ -2864,12 +2899,12 @@ Console.WriteLine(" JointCreateFixed"); | |||
2864 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); | 2899 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); |
2865 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); | 2900 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); |
2866 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); | 2901 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); |
2867 | 2902 | ||
2868 | // Note here that linearvelocity is affecting angular velocity... so I'm guessing this is a vehicle specific thing... | 2903 | // Note here that linearvelocity is affecting angular velocity... so I'm guessing this is a vehicle specific thing... |
2869 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. | 2904 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. |
2870 | // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles | 2905 | // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles |
2871 | // adding these logical exclusion situations to maintain this where I think it was intended to be. | 2906 | // adding these logical exclusion situations to maintain this where I think it was intended to be. |
2872 | if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) | 2907 | if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) |
2873 | { | 2908 | { |
2874 | m_minvelocity = 0.5f; | 2909 | m_minvelocity = 0.5f; |
2875 | } | 2910 | } |
@@ -2938,8 +2973,8 @@ Console.WriteLine(" JointCreateFixed"); | |||
2938 | { | 2973 | { |
2939 | } | 2974 | } |
2940 | 2975 | ||
2941 | public override Vector3 PIDTarget | 2976 | public override Vector3 PIDTarget |
2942 | { | 2977 | { |
2943 | set | 2978 | set |
2944 | { | 2979 | { |
2945 | if (value.IsFinite()) | 2980 | if (value.IsFinite()) |
@@ -2948,16 +2983,17 @@ Console.WriteLine(" JointCreateFixed"); | |||
2948 | } | 2983 | } |
2949 | else | 2984 | else |
2950 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); | 2985 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); |
2951 | } | 2986 | } |
2952 | } | 2987 | } |
2988 | |||
2953 | public override bool PIDActive { get; set; } | 2989 | public override bool PIDActive { get; set; } |
2954 | public override float PIDTau { set { m_PIDTau = value; } } | 2990 | public override float PIDTau { set { m_PIDTau = value; } } |
2955 | 2991 | ||
2956 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } | 2992 | public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } |
2957 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } | 2993 | public override bool PIDHoverActive { get { return m_useHoverPID;} set { m_useHoverPID = value; } } |
2958 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } | 2994 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } |
2959 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } | 2995 | public override float PIDHoverTau { set { m_PIDHoverTau = value; } } |
2960 | 2996 | ||
2961 | public override Quaternion APIDTarget{ set { return; } } | 2997 | public override Quaternion APIDTarget{ set { return; } } |
2962 | 2998 | ||
2963 | public override bool APIDActive{ set { return; } } | 2999 | public override bool APIDActive{ set { return; } } |
@@ -2966,7 +3002,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2966 | 3002 | ||
2967 | public override float APIDDamping{ set { return; } } | 3003 | public override float APIDDamping{ set { return; } } |
2968 | 3004 | ||
2969 | private void createAMotor(Vector3 axis) | 3005 | private void createAMotor(byte axislock) |
2970 | { | 3006 | { |
2971 | if (Body == IntPtr.Zero) | 3007 | if (Body == IntPtr.Zero) |
2972 | return; | 3008 | return; |
@@ -2977,150 +3013,105 @@ Console.WriteLine(" JointCreateFixed"); | |||
2977 | Amotor = IntPtr.Zero; | 3013 | Amotor = IntPtr.Zero; |
2978 | } | 3014 | } |
2979 | 3015 | ||
2980 | float axisnum = 3; | 3016 | if(axislock == 0) |
2981 | 3017 | return; | |
2982 | axisnum = (axisnum - (axis.X + axis.Y + axis.Z)); | ||
2983 | |||
2984 | // PhysicsVector totalSize = new PhysicsVector(_size.X, _size.Y, _size.Z); | ||
2985 | |||
2986 | |||
2987 | // Inverse Inertia Matrix, set the X, Y, and/r Z inertia to 0 then invert it again. | ||
2988 | d.Mass objMass; | ||
2989 | d.MassSetZero(out objMass); | ||
2990 | DMassCopy(ref pMass, ref objMass); | ||
2991 | |||
2992 | //m_log.DebugFormat("1-{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, ", objMass.I.M00, objMass.I.M01, objMass.I.M02, objMass.I.M10, objMass.I.M11, objMass.I.M12, objMass.I.M20, objMass.I.M21, objMass.I.M22); | ||
2993 | |||
2994 | Matrix4 dMassMat = FromDMass(objMass); | ||
2995 | |||
2996 | Matrix4 mathmat = Inverse(dMassMat); | ||
2997 | |||
2998 | /* | ||
2999 | //m_log.DebugFormat("2-{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, ", mathmat[0, 0], mathmat[0, 1], mathmat[0, 2], mathmat[1, 0], mathmat[1, 1], mathmat[1, 2], mathmat[2, 0], mathmat[2, 1], mathmat[2, 2]); | ||
3000 | |||
3001 | mathmat = Inverse(mathmat); | ||
3002 | |||
3003 | |||
3004 | objMass = FromMatrix4(mathmat, ref objMass); | ||
3005 | //m_log.DebugFormat("3-{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, ", objMass.I.M00, objMass.I.M01, objMass.I.M02, objMass.I.M10, objMass.I.M11, objMass.I.M12, objMass.I.M20, objMass.I.M21, objMass.I.M22); | ||
3006 | |||
3007 | mathmat = Inverse(mathmat); | ||
3008 | */ | ||
3009 | if (axis.X == 0) | ||
3010 | { | ||
3011 | mathmat.M33 = 50.0000001f; | ||
3012 | //objMass.I.M22 = 0; | ||
3013 | } | ||
3014 | if (axis.Y == 0) | ||
3015 | { | ||
3016 | mathmat.M22 = 50.0000001f; | ||
3017 | //objMass.I.M11 = 0; | ||
3018 | } | ||
3019 | if (axis.Z == 0) | ||
3020 | { | ||
3021 | mathmat.M11 = 50.0000001f; | ||
3022 | //objMass.I.M00 = 0; | ||
3023 | } | ||
3024 | |||
3025 | |||
3026 | 3018 | ||
3027 | mathmat = Inverse(mathmat); | 3019 | int axisnum = 0; |
3028 | objMass = FromMatrix4(mathmat, ref objMass); | 3020 | bool axisX = false; |
3029 | //m_log.DebugFormat("4-{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, ", objMass.I.M00, objMass.I.M01, objMass.I.M02, objMass.I.M10, objMass.I.M11, objMass.I.M12, objMass.I.M20, objMass.I.M21, objMass.I.M22); | 3021 | bool axisY = false; |
3030 | 3022 | bool axisZ = false; | |
3031 | //return; | 3023 | if((axislock & 0x02) != 0) |
3032 | if (d.MassCheck(ref objMass)) | 3024 | { |
3033 | { | 3025 | axisnum++; |
3034 | d.BodySetMass(Body, ref objMass); | 3026 | axisX = true; |
3035 | } | 3027 | } |
3036 | else | 3028 | if((axislock & 0x04) != 0) |
3037 | { | 3029 | { |
3038 | //m_log.Debug("[PHYSICS]: Mass invalid, ignoring"); | 3030 | axisnum++; |
3039 | } | 3031 | axisY = true; |
3032 | } | ||
3033 | if((axislock & 0x08) != 0) | ||
3034 | { | ||
3035 | axisnum++; | ||
3036 | axisZ = true; | ||
3037 | } | ||
3040 | 3038 | ||
3041 | if (axisnum <= 0) | 3039 | if(axisnum == 0) |
3042 | return; | 3040 | return; |
3043 | // int dAMotorEuler = 1; | 3041 | // stop it |
3042 | d.BodySetTorque(Body, 0, 0, 0); | ||
3043 | d.BodySetAngularVel(Body, 0, 0, 0); | ||
3044 | 3044 | ||
3045 | Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); | 3045 | Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); |
3046 | d.JointAttach(Amotor, Body, IntPtr.Zero); | 3046 | d.JointAttach(Amotor, Body, IntPtr.Zero); |
3047 | |||
3047 | d.JointSetAMotorMode(Amotor, 0); | 3048 | d.JointSetAMotorMode(Amotor, 0); |
3048 | 3049 | ||
3049 | d.JointSetAMotorNumAxes(Amotor,(int)axisnum); | 3050 | d.JointSetAMotorNumAxes(Amotor, axisnum); |
3050 | int i = 0; | ||
3051 | 3051 | ||
3052 | if (axis.X == 0) | 3052 | // get current orientation to lock |
3053 | { | ||
3054 | d.JointSetAMotorAxis(Amotor, i, 0, 1, 0, 0); | ||
3055 | i++; | ||
3056 | } | ||
3057 | 3053 | ||
3058 | if (axis.Y == 0) | 3054 | d.Quaternion dcur = d.BodyGetQuaternion(Body); |
3059 | { | 3055 | Quaternion curr; // crap convertion between identical things |
3060 | d.JointSetAMotorAxis(Amotor, i, 0, 0, 1, 0); | 3056 | curr.X = dcur.X; |
3061 | i++; | 3057 | curr.Y = dcur.Y; |
3062 | } | 3058 | curr.Z = dcur.Z; |
3059 | curr.W = dcur.W; | ||
3060 | Vector3 ax; | ||
3063 | 3061 | ||
3064 | if (axis.Z == 0) | 3062 | int i = 0; |
3065 | { | 3063 | int j = 0; |
3066 | d.JointSetAMotorAxis(Amotor, i, 0, 0, 0, 1); | 3064 | if (axisX) |
3065 | { | ||
3066 | ax = (new Vector3(1, 0, 0)) * curr; // rotate world X to current local X | ||
3067 | d.JointSetAMotorAxis(Amotor, 0, 0, ax.X, ax.Y, ax.Z); | ||
3068 | d.JointSetAMotorAngle(Amotor, 0, 0); | ||
3069 | d.JointSetAMotorParam(Amotor, (int)d.JointParam.LoStop, 0f); | ||
3070 | d.JointSetAMotorParam(Amotor, (int)d.JointParam.HiStop, 0f); | ||
3071 | d.JointSetAMotorParam(Amotor, (int)d.JointParam.Vel, 0); | ||
3072 | d.JointSetAMotorParam(Amotor, (int)d.JointParam.FudgeFactor, 0.0001f); | ||
3073 | d.JointSetAMotorParam(Amotor, (int)d.JointParam.Bounce, 0f); | ||
3074 | d.JointSetAMotorParam(Amotor, (int)d.JointParam.CFM, 0f); | ||
3075 | d.JointSetAMotorParam(Amotor, (int)d.JointParam.FMax, 5e8f); | ||
3076 | d.JointSetAMotorParam(Amotor, (int)d.JointParam.StopCFM, 0f); | ||
3077 | d.JointSetAMotorParam(Amotor, (int)d.JointParam.StopERP, 0.8f); | ||
3078 | i++; | ||
3079 | j = 256; // move to next axis set | ||
3080 | } | ||
3081 | |||
3082 | if (axisY) | ||
3083 | { | ||
3084 | ax = (new Vector3(0, 1, 0)) * curr; | ||
3085 | d.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z); | ||
3086 | d.JointSetAMotorAngle(Amotor, i, 0); | ||
3087 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.LoStop, 0f); | ||
3088 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.HiStop, 0f); | ||
3089 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Vel, 0); | ||
3090 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FudgeFactor, 0.0001f); | ||
3091 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Bounce, 0f); | ||
3092 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.CFM, 0f); | ||
3093 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FMax, 5e8f); | ||
3094 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopCFM, 0f); | ||
3095 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopERP, 0.8f); | ||
3067 | i++; | 3096 | i++; |
3097 | j += 256; | ||
3068 | } | 3098 | } |
3069 | 3099 | ||
3070 | for (int j = 0; j < (int)axisnum; j++) | 3100 | if (axisZ) |
3071 | { | 3101 | { |
3072 | //d.JointSetAMotorAngle(Amotor, j, 0); | 3102 | ax = (new Vector3(0, 0, 1)) * curr; |
3103 | d.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z); | ||
3104 | d.JointSetAMotorAngle(Amotor, i, 0); | ||
3105 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.LoStop, 0f); | ||
3106 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.HiStop, 0f); | ||
3107 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Vel, 0); | ||
3108 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FudgeFactor, 0.0001f); | ||
3109 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Bounce, 0f); | ||
3110 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.CFM, 0f); | ||
3111 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FMax, 5e8f); | ||
3112 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopCFM, 0f); | ||
3113 | d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopERP, 0.8f); | ||
3073 | } | 3114 | } |
3074 | |||
3075 | //d.JointSetAMotorAngle(Amotor, 1, 0); | ||
3076 | //d.JointSetAMotorAngle(Amotor, 2, 0); | ||
3077 | |||
3078 | // These lowstops and high stops are effectively (no wiggle room) | ||
3079 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0f); | ||
3080 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f); | ||
3081 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0f); | ||
3082 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0f); | ||
3083 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); | ||
3084 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0f); | ||
3085 | //d.JointSetAMotorParam(Amotor, (int) dParam.Vel, 9000f); | ||
3086 | d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); | ||
3087 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, Mass * 50f);// | ||
3088 | } | ||
3089 | |||
3090 | private Matrix4 FromDMass(d.Mass pMass) | ||
3091 | { | ||
3092 | Matrix4 obj; | ||
3093 | obj.M11 = pMass.I.M00; | ||
3094 | obj.M12 = pMass.I.M01; | ||
3095 | obj.M13 = pMass.I.M02; | ||
3096 | obj.M14 = 0; | ||
3097 | obj.M21 = pMass.I.M10; | ||
3098 | obj.M22 = pMass.I.M11; | ||
3099 | obj.M23 = pMass.I.M12; | ||
3100 | obj.M24 = 0; | ||
3101 | obj.M31 = pMass.I.M20; | ||
3102 | obj.M32 = pMass.I.M21; | ||
3103 | obj.M33 = pMass.I.M22; | ||
3104 | obj.M34 = 0; | ||
3105 | obj.M41 = 0; | ||
3106 | obj.M42 = 0; | ||
3107 | obj.M43 = 0; | ||
3108 | obj.M44 = 1; | ||
3109 | return obj; | ||
3110 | } | ||
3111 | |||
3112 | private d.Mass FromMatrix4(Matrix4 pMat, ref d.Mass obj) | ||
3113 | { | ||
3114 | obj.I.M00 = pMat[0, 0]; | ||
3115 | obj.I.M01 = pMat[0, 1]; | ||
3116 | obj.I.M02 = pMat[0, 2]; | ||
3117 | obj.I.M10 = pMat[1, 0]; | ||
3118 | obj.I.M11 = pMat[1, 1]; | ||
3119 | obj.I.M12 = pMat[1, 2]; | ||
3120 | obj.I.M20 = pMat[2, 0]; | ||
3121 | obj.I.M21 = pMat[2, 1]; | ||
3122 | obj.I.M22 = pMat[2, 2]; | ||
3123 | return obj; | ||
3124 | } | 3115 | } |
3125 | 3116 | ||
3126 | public override void SubscribeEvents(int ms) | 3117 | public override void SubscribeEvents(int ms) |
@@ -3135,7 +3126,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
3135 | m_eventsubscription = 0; | 3126 | m_eventsubscription = 0; |
3136 | } | 3127 | } |
3137 | 3128 | ||
3138 | public void AddCollisionEvent(uint CollidedWith, ContactPoint contact) | 3129 | public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) |
3139 | { | 3130 | { |
3140 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | 3131 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); |
3141 | } | 3132 | } |
@@ -3165,173 +3156,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
3165 | return false; | 3156 | return false; |
3166 | } | 3157 | } |
3167 | 3158 | ||
3168 | public static Matrix4 Inverse(Matrix4 pMat) | ||
3169 | { | ||
3170 | if (determinant3x3(pMat) == 0) | ||
3171 | { | ||
3172 | return Matrix4.Identity; // should probably throw an error. singluar matrix inverse not possible | ||
3173 | } | ||
3174 | |||
3175 | return (Adjoint(pMat) / determinant3x3(pMat)); | ||
3176 | } | ||
3177 | |||
3178 | public static Matrix4 Adjoint(Matrix4 pMat) | ||
3179 | { | ||
3180 | Matrix4 adjointMatrix = new Matrix4(); | ||
3181 | for (int i=0; i<4; i++) | ||
3182 | { | ||
3183 | for (int j=0; j<4; j++) | ||
3184 | { | ||
3185 | Matrix4SetValue(ref adjointMatrix, i, j, (float)(Math.Pow(-1, i + j) * (determinant3x3(Minor(pMat, i, j))))); | ||
3186 | } | ||
3187 | } | ||
3188 | |||
3189 | adjointMatrix = Transpose(adjointMatrix); | ||
3190 | return adjointMatrix; | ||
3191 | } | ||
3192 | |||
3193 | public static Matrix4 Minor(Matrix4 matrix, int iRow, int iCol) | ||
3194 | { | ||
3195 | Matrix4 minor = new Matrix4(); | ||
3196 | int m = 0, n = 0; | ||
3197 | for (int i = 0; i < 4; i++) | ||
3198 | { | ||
3199 | if (i == iRow) | ||
3200 | continue; | ||
3201 | n = 0; | ||
3202 | for (int j = 0; j < 4; j++) | ||
3203 | { | ||
3204 | if (j == iCol) | ||
3205 | continue; | ||
3206 | Matrix4SetValue(ref minor, m,n, matrix[i, j]); | ||
3207 | n++; | ||
3208 | } | ||
3209 | m++; | ||
3210 | } | ||
3211 | |||
3212 | return minor; | ||
3213 | } | ||
3214 | |||
3215 | public static Matrix4 Transpose(Matrix4 pMat) | ||
3216 | { | ||
3217 | Matrix4 transposeMatrix = new Matrix4(); | ||
3218 | for (int i = 0; i < 4; i++) | ||
3219 | for (int j = 0; j < 4; j++) | ||
3220 | Matrix4SetValue(ref transposeMatrix, i, j, pMat[j, i]); | ||
3221 | return transposeMatrix; | ||
3222 | } | ||
3223 | |||
3224 | public static void Matrix4SetValue(ref Matrix4 pMat, int r, int c, float val) | ||
3225 | { | ||
3226 | switch (r) | ||
3227 | { | ||
3228 | case 0: | ||
3229 | switch (c) | ||
3230 | { | ||
3231 | case 0: | ||
3232 | pMat.M11 = val; | ||
3233 | break; | ||
3234 | case 1: | ||
3235 | pMat.M12 = val; | ||
3236 | break; | ||
3237 | case 2: | ||
3238 | pMat.M13 = val; | ||
3239 | break; | ||
3240 | case 3: | ||
3241 | pMat.M14 = val; | ||
3242 | break; | ||
3243 | } | ||
3244 | |||
3245 | break; | ||
3246 | case 1: | ||
3247 | switch (c) | ||
3248 | { | ||
3249 | case 0: | ||
3250 | pMat.M21 = val; | ||
3251 | break; | ||
3252 | case 1: | ||
3253 | pMat.M22 = val; | ||
3254 | break; | ||
3255 | case 2: | ||
3256 | pMat.M23 = val; | ||
3257 | break; | ||
3258 | case 3: | ||
3259 | pMat.M24 = val; | ||
3260 | break; | ||
3261 | } | ||
3262 | |||
3263 | break; | ||
3264 | case 2: | ||
3265 | switch (c) | ||
3266 | { | ||
3267 | case 0: | ||
3268 | pMat.M31 = val; | ||
3269 | break; | ||
3270 | case 1: | ||
3271 | pMat.M32 = val; | ||
3272 | break; | ||
3273 | case 2: | ||
3274 | pMat.M33 = val; | ||
3275 | break; | ||
3276 | case 3: | ||
3277 | pMat.M34 = val; | ||
3278 | break; | ||
3279 | } | ||
3280 | |||
3281 | break; | ||
3282 | case 3: | ||
3283 | switch (c) | ||
3284 | { | ||
3285 | case 0: | ||
3286 | pMat.M41 = val; | ||
3287 | break; | ||
3288 | case 1: | ||
3289 | pMat.M42 = val; | ||
3290 | break; | ||
3291 | case 2: | ||
3292 | pMat.M43 = val; | ||
3293 | break; | ||
3294 | case 3: | ||
3295 | pMat.M44 = val; | ||
3296 | break; | ||
3297 | } | ||
3298 | |||
3299 | break; | ||
3300 | } | ||
3301 | } | ||
3302 | |||
3303 | private static float determinant3x3(Matrix4 pMat) | ||
3304 | { | ||
3305 | float det = 0; | ||
3306 | float diag1 = pMat[0, 0]*pMat[1, 1]*pMat[2, 2]; | ||
3307 | float diag2 = pMat[0, 1]*pMat[2, 1]*pMat[2, 0]; | ||
3308 | float diag3 = pMat[0, 2]*pMat[1, 0]*pMat[2, 1]; | ||
3309 | float diag4 = pMat[2, 0]*pMat[1, 1]*pMat[0, 2]; | ||
3310 | float diag5 = pMat[2, 1]*pMat[1, 2]*pMat[0, 0]; | ||
3311 | float diag6 = pMat[2, 2]*pMat[1, 0]*pMat[0, 1]; | ||
3312 | |||
3313 | det = diag1 + diag2 + diag3 - (diag4 + diag5 + diag6); | ||
3314 | return det; | ||
3315 | } | ||
3316 | |||
3317 | private static void DMassCopy(ref d.Mass src, ref d.Mass dst) | ||
3318 | { | ||
3319 | dst.c.W = src.c.W; | ||
3320 | dst.c.X = src.c.X; | ||
3321 | dst.c.Y = src.c.Y; | ||
3322 | dst.c.Z = src.c.Z; | ||
3323 | dst.mass = src.mass; | ||
3324 | dst.I.M00 = src.I.M00; | ||
3325 | dst.I.M01 = src.I.M01; | ||
3326 | dst.I.M02 = src.I.M02; | ||
3327 | dst.I.M10 = src.I.M10; | ||
3328 | dst.I.M11 = src.I.M11; | ||
3329 | dst.I.M12 = src.I.M12; | ||
3330 | dst.I.M20 = src.I.M20; | ||
3331 | dst.I.M21 = src.I.M21; | ||
3332 | dst.I.M22 = src.I.M22; | ||
3333 | } | ||
3334 | |||
3335 | public override void SetMaterial(int pMaterial) | 3159 | public override void SetMaterial(int pMaterial) |
3336 | { | 3160 | { |
3337 | m_material = pMaterial; | 3161 | m_material = pMaterial; |
@@ -3365,7 +3189,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
3365 | // m_assetFailed = false; | 3189 | // m_assetFailed = false; |
3366 | 3190 | ||
3367 | // m_log.DebugFormat( | 3191 | // m_log.DebugFormat( |
3368 | // "[ODE PRIM]: Received mesh/sculpt data asset {0} with {1} bytes for {2} at {3} in {4}", | 3192 | // "[ODE PRIM]: Received mesh/sculpt data asset {0} with {1} bytes for {2} at {3} in {4}", |
3369 | // _pbs.SculptTexture, _pbs.SculptData.Length, Name, _position, _parent_scene.Name); | 3193 | // _pbs.SculptTexture, _pbs.SculptData.Length, Name, _position, _parent_scene.Name); |
3370 | 3194 | ||
3371 | m_taintshape = true; | 3195 | m_taintshape = true; |
@@ -3377,6 +3201,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
3377 | "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", | 3201 | "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", |
3378 | _pbs.SculptTexture, Name, _position, _parent_scene.PhysicsSceneName); | 3202 | _pbs.SculptTexture, Name, _position, _parent_scene.PhysicsSceneName); |
3379 | } | 3203 | } |
3380 | } | 3204 | } |
3381 | } | 3205 | } |
3382 | } \ No newline at end of file | 3206 | } \ No newline at end of file |
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs index 8d610f7..78dd7de 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs | |||
@@ -32,7 +32,6 @@ using System.Runtime.InteropServices; | |||
32 | using System.Text; | 32 | using System.Text; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Region.PhysicsModules.SharedBase; | 34 | using OpenSim.Region.PhysicsModules.SharedBase; |
35 | using Ode.NET; | ||
36 | using log4net; | 35 | using log4net; |
37 | 36 | ||
38 | namespace OpenSim.Region.PhysicsModule.ODE | 37 | namespace OpenSim.Region.PhysicsModule.ODE |
@@ -76,7 +75,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
76 | { | 75 | { |
77 | m_scene = pScene; | 76 | m_scene = pScene; |
78 | nearCallback = near; | 77 | nearCallback = near; |
79 | 78 | ||
80 | } | 79 | } |
81 | 80 | ||
82 | /// <summary> | 81 | /// <summary> |
@@ -137,7 +136,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
137 | ODERayCastRequest[] reqs = m_PendingRequests.ToArray(); | 136 | ODERayCastRequest[] reqs = m_PendingRequests.ToArray(); |
138 | for (int i = 0; i < reqs.Length; i++) | 137 | for (int i = 0; i < reqs.Length; i++) |
139 | { | 138 | { |
140 | if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast | 139 | if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast |
141 | RayCast(reqs[i]); // if there isn't anyone to send results | 140 | RayCast(reqs[i]); // if there isn't anyone to send results |
142 | } | 141 | } |
143 | 142 | ||
@@ -152,7 +151,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
152 | ODERayRequest[] reqs = m_PendingRayRequests.ToArray(); | 151 | ODERayRequest[] reqs = m_PendingRayRequests.ToArray(); |
153 | for (int i = 0; i < reqs.Length; i++) | 152 | for (int i = 0; i < reqs.Length; i++) |
154 | { | 153 | { |
155 | if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast | 154 | if (reqs[i].callbackMethod != null) // quick optimization here, don't raycast |
156 | RayCast(reqs[i]); // if there isn't anyone to send results | 155 | RayCast(reqs[i]); // if there isn't anyone to send results |
157 | } | 156 | } |
158 | 157 | ||
@@ -176,11 +175,11 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
176 | // this value may still be too large, depending on machine configuration | 175 | // this value may still be too large, depending on machine configuration |
177 | // of maximum stack | 176 | // of maximum stack |
178 | float len = req.length; | 177 | float len = req.length; |
179 | if (len > 250f) | 178 | if (len > 100f) |
180 | len = 250f; | 179 | len = 100f; |
181 | 180 | ||
182 | // Create the ray | 181 | // Create the ray |
183 | IntPtr ray = d.CreateRay(m_scene.space, req.length); | 182 | IntPtr ray = d.CreateRay(m_scene.space, len); |
184 | d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); | 183 | d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); |
185 | 184 | ||
186 | // Collide test | 185 | // Collide test |
@@ -225,8 +224,13 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
225 | /// <param name="req"></param> | 224 | /// <param name="req"></param> |
226 | private void RayCast(ODERayRequest req) | 225 | private void RayCast(ODERayRequest req) |
227 | { | 226 | { |
227 | // limit ray length or collisions will take all avaiable stack space | ||
228 | float len = req.length; | ||
229 | if (len > 100f) | ||
230 | len = 100f; | ||
231 | |||
228 | // Create the ray | 232 | // Create the ray |
229 | IntPtr ray = d.CreateRay(m_scene.space, req.length); | 233 | IntPtr ray = d.CreateRay(m_scene.space, len); |
230 | d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); | 234 | d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); |
231 | 235 | ||
232 | // Collide test | 236 | // Collide test |
@@ -243,83 +247,22 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
243 | req.callbackMethod(m_contactResults); | 247 | req.callbackMethod(m_contactResults); |
244 | } | 248 | } |
245 | } | 249 | } |
246 | 250 | ||
247 | // This is the standard Near. Uses space AABBs to speed up detection. | 251 | // This is the standard Near. Uses space AABBs to speed up detection. |
248 | private void near(IntPtr space, IntPtr g1, IntPtr g2) | 252 | private void near(IntPtr space, IntPtr g1, IntPtr g2) |
249 | { | 253 | { |
250 | 254 | ||
251 | //Don't test against heightfield Geom, or you'll be sorry! | ||
252 | |||
253 | /* | ||
254 | terminate called after throwing an instance of 'std::bad_alloc' | ||
255 | what(): std::bad_alloc | ||
256 | Stacktrace: | ||
257 | |||
258 | at (wrapper managed-to-native) Ode.NET.d.Collide (intptr,intptr,int,Ode.NET.d/ContactGeom[],int) <0x00004> | ||
259 | at (wrapper managed-to-native) Ode.NET.d.Collide (intptr,intptr,int,Ode.NET.d/ContactGeom[],int) <0xffffffff> | ||
260 | at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.near (intptr,intptr,intptr) <0x00280> | ||
261 | at (wrapper native-to-managed) OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.near (intptr,intptr,intptr) <0xfff | ||
262 | fffff> | ||
263 | at (wrapper managed-to-native) Ode.NET.d.SpaceCollide2 (intptr,intptr,intptr,Ode.NET.d/NearCallback) <0x00004> | ||
264 | at (wrapper managed-to-native) Ode.NET.d.SpaceCollide2 (intptr,intptr,intptr,Ode.NET.d/NearCallback) <0xffffffff> | ||
265 | at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.RayCast (OpenSim.Region.Physics.OdePlugin.ODERayCastRequest) < | ||
266 | 0x00114> | ||
267 | at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.ProcessQueuedRequests () <0x000eb> | ||
268 | at OpenSim.Region.Physics.OdePlugin.OdeScene.Simulate (single) <0x017e6> | ||
269 | at OpenSim.Region.Framework.Scenes.SceneGraph.UpdatePhysics (double) <0x00042> | ||
270 | at OpenSim.Region.Framework.Scenes.Scene.Update () <0x0039e> | ||
271 | at OpenSim.Region.Framework.Scenes.Scene.Heartbeat (object) <0x00019> | ||
272 | at (wrapper runtime-invoke) object.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff> | ||
273 | |||
274 | Native stacktrace: | ||
275 | |||
276 | mono [0x80d2a42] | ||
277 | [0xb7f5840c] | ||
278 | /lib/i686/cmov/libc.so.6(abort+0x188) [0xb7d1a018] | ||
279 | /usr/lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x158) [0xb45fc988] | ||
280 | /usr/lib/libstdc++.so.6 [0xb45fa865] | ||
281 | /usr/lib/libstdc++.so.6 [0xb45fa8a2] | ||
282 | /usr/lib/libstdc++.so.6 [0xb45fa9da] | ||
283 | /usr/lib/libstdc++.so.6(_Znwj+0x83) [0xb45fb033] | ||
284 | /usr/lib/libstdc++.so.6(_Znaj+0x1d) [0xb45fb11d] | ||
285 | libode.so(_ZN13dxHeightfield23dCollideHeightfieldZoneEiiiiP6dxGeomiiP12dContactGeomi+0xd04) [0xb46678e4] | ||
286 | libode.so(_Z19dCollideHeightfieldP6dxGeomS0_iP12dContactGeomi+0x54b) [0xb466832b] | ||
287 | libode.so(dCollide+0x102) [0xb46571b2] | ||
288 | [0x95cfdec9] | ||
289 | [0x8ea07fe1] | ||
290 | [0xab260146] | ||
291 | libode.so [0xb465a5c4] | ||
292 | libode.so(_ZN11dxHashSpace8collide2EPvP6dxGeomPFvS0_S2_S2_E+0x75) [0xb465bcf5] | ||
293 | libode.so(dSpaceCollide2+0x177) [0xb465ac67] | ||
294 | [0x95cf978e] | ||
295 | [0x8ea07945] | ||
296 | [0x95cf2bbc] | ||
297 | [0xab2787e7] | ||
298 | [0xab419fb3] | ||
299 | [0xab416657] | ||
300 | [0xab415bda] | ||
301 | [0xb609b08e] | ||
302 | mono(mono_runtime_delegate_invoke+0x34) [0x8192534] | ||
303 | mono [0x81a2f0f] | ||
304 | mono [0x81d28b6] | ||
305 | mono [0x81ea2c6] | ||
306 | /lib/i686/cmov/libpthread.so.0 [0xb7e744c0] | ||
307 | /lib/i686/cmov/libc.so.6(clone+0x5e) [0xb7dcd6de] | ||
308 | */ | ||
309 | |||
310 | // Exclude heightfield geom | ||
311 | |||
312 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) | 255 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) |
313 | return; | 256 | return; |
314 | if (d.GeomGetClass(g1) == d.GeomClassID.HeightfieldClass || d.GeomGetClass(g2) == d.GeomClassID.HeightfieldClass) | 257 | // if (d.GeomGetClass(g1) == d.GeomClassID.HeightfieldClass || d.GeomGetClass(g2) == d.GeomClassID.HeightfieldClass) |
315 | return; | 258 | // return; |
316 | 259 | ||
317 | // Raytest against AABBs of spaces first, then dig into the spaces it hits for actual geoms. | 260 | // Raytest against AABBs of spaces first, then dig into the spaces it hits for actual geoms. |
318 | if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) | 261 | if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) |
319 | { | 262 | { |
320 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) | 263 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) |
321 | return; | 264 | return; |
322 | 265 | ||
323 | // Separating static prim geometry spaces. | 266 | // Separating static prim geometry spaces. |
324 | // We'll be calling near recursivly if one | 267 | // We'll be calling near recursivly if one |
325 | // of them is a space to find all of the | 268 | // of them is a space to find all of the |
@@ -347,13 +290,13 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
347 | int count = 0; | 290 | int count = 0; |
348 | try | 291 | try |
349 | { | 292 | { |
350 | 293 | ||
351 | if (g1 == g2) | 294 | if (g1 == g2) |
352 | return; // Can't collide with yourself | 295 | return; // Can't collide with yourself |
353 | 296 | ||
354 | lock (contacts) | 297 | lock (contacts) |
355 | { | 298 | { |
356 | count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); | 299 | count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.unmanagedSizeOf); |
357 | } | 300 | } |
358 | } | 301 | } |
359 | catch (SEHException) | 302 | catch (SEHException) |
@@ -383,7 +326,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
383 | if (p1 is OdePrim) | 326 | if (p1 is OdePrim) |
384 | { | 327 | { |
385 | ContactResult collisionresult = new ContactResult(); | 328 | ContactResult collisionresult = new ContactResult(); |
386 | 329 | ||
387 | collisionresult.ConsumerID = p1.LocalID; | 330 | collisionresult.ConsumerID = p1.LocalID; |
388 | collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); | 331 | collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); |
389 | collisionresult.Depth = contacts[i].depth; | 332 | collisionresult.Depth = contacts[i].depth; |
@@ -438,4 +381,4 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
438 | public float length; | 381 | public float length; |
439 | public RayCallback callbackMethod; | 382 | public RayCallback callbackMethod; |
440 | } | 383 | } |
441 | } \ No newline at end of file | 384 | } |
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs index 2eb7ba6..e2578be 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs | |||
@@ -27,10 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | using Ode.NET; | ||
31 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
32 | using OpenSim.Region.PhysicsModules.SharedBase; | 31 | using OpenSim.Region.PhysicsModules.SharedBase; |
33 | using OpenSim.Region.PhysicsModule.ODE; | ||
34 | 32 | ||
35 | namespace OpenSim.Region.PhysicsModule.ODE | 33 | namespace OpenSim.Region.PhysicsModule.ODE |
36 | { | 34 | { |
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 8cc7f28..d15568e 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | |||
@@ -31,31 +31,24 @@ | |||
31 | // or application thread stack may just blowup | 31 | // or application thread stack may just blowup |
32 | // see RayCast(ODERayCastRequest req) | 32 | // see RayCast(ODERayCastRequest req) |
33 | 33 | ||
34 | //#define USE_DRAWSTUFF | ||
35 | //#define SPAM | ||
36 | |||
37 | using System; | 34 | using System; |
38 | using System.Collections.Generic; | 35 | using System.Collections.Generic; |
39 | using System.Diagnostics; | 36 | using System.Diagnostics; |
40 | using System.IO; | 37 | using System.IO; |
41 | using System.Linq; | 38 | using System.Linq; |
42 | using System.Reflection; | 39 | using System.Reflection; |
40 | using System.Runtime.ExceptionServices; | ||
43 | using System.Runtime.InteropServices; | 41 | using System.Runtime.InteropServices; |
44 | using System.Threading; | 42 | using System.Threading; |
45 | using log4net; | 43 | using log4net; |
46 | using Nini.Config; | 44 | using Nini.Config; |
47 | using Mono.Addins; | 45 | using Mono.Addins; |
48 | using Ode.NET; | ||
49 | using OpenMetaverse; | 46 | using OpenMetaverse; |
50 | #if USE_DRAWSTUFF | ||
51 | using Drawstuff.NET; | ||
52 | #endif | ||
53 | using OpenSim.Framework; | 47 | using OpenSim.Framework; |
54 | using OpenSim.Region.PhysicsModules.SharedBase; | 48 | using OpenSim.Region.PhysicsModules.SharedBase; |
55 | using OpenSim.Region.Framework.Scenes; | 49 | using OpenSim.Region.Framework.Scenes; |
56 | using OpenSim.Region.Framework.Interfaces; | 50 | using OpenSim.Region.Framework.Interfaces; |
57 | 51 | ||
58 | |||
59 | namespace OpenSim.Region.PhysicsModule.ODE | 52 | namespace OpenSim.Region.PhysicsModule.ODE |
60 | { | 53 | { |
61 | public enum StatusIndicators : int | 54 | public enum StatusIndicators : int |
@@ -65,16 +58,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
65 | End = 2 | 58 | End = 2 |
66 | } | 59 | } |
67 | 60 | ||
68 | // public struct sCollisionData | ||
69 | // { | ||
70 | // public uint ColliderLocalId; | ||
71 | // public uint CollidedWithLocalId; | ||
72 | // public int NumberOfCollisions; | ||
73 | // public int CollisionType; | ||
74 | // public int StatusIndicator; | ||
75 | // public int lastframe; | ||
76 | // } | ||
77 | |||
78 | [Flags] | 61 | [Flags] |
79 | public enum CollisionCategories : int | 62 | public enum CollisionCategories : int |
80 | { | 63 | { |
@@ -111,11 +94,9 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
111 | Rubber = 6 | 94 | Rubber = 6 |
112 | } | 95 | } |
113 | 96 | ||
114 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")] | 97 | public class OdeScene : PhysicsScene |
115 | public class OdeScene : PhysicsScene, INonSharedRegionModule | ||
116 | { | 98 | { |
117 | private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString()); | 99 | private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString()); |
118 | private bool m_Enabled = false; | ||
119 | 100 | ||
120 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); | 101 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); |
121 | 102 | ||
@@ -144,6 +125,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
144 | /// .../opensim/bin/libode-x86_64.so(_Z12dCollideCCTLP6dxGeomS0_iP12dContactGeomi+0x92) [0x7f03b44bcf82] | 125 | /// .../opensim/bin/libode-x86_64.so(_Z12dCollideCCTLP6dxGeomS0_iP12dContactGeomi+0x92) [0x7f03b44bcf82] |
145 | /// </remarks> | 126 | /// </remarks> |
146 | internal static Object UniversalColliderSyncObject = new Object(); | 127 | internal static Object UniversalColliderSyncObject = new Object(); |
128 | internal static Object SimulationLock = new Object(); | ||
147 | 129 | ||
148 | /// <summary> | 130 | /// <summary> |
149 | /// Is stats collecting enabled for this ODE scene? | 131 | /// Is stats collecting enabled for this ODE scene? |
@@ -276,8 +258,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
276 | 258 | ||
277 | private Random fluidRandomizer = new Random(Environment.TickCount); | 259 | private Random fluidRandomizer = new Random(Environment.TickCount); |
278 | 260 | ||
279 | public bool m_suportCombine = true; | ||
280 | |||
281 | private uint m_regionWidth = Constants.RegionSize; | 261 | private uint m_regionWidth = Constants.RegionSize; |
282 | private uint m_regionHeight = Constants.RegionSize; | 262 | private uint m_regionHeight = Constants.RegionSize; |
283 | 263 | ||
@@ -293,11 +273,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
293 | 273 | ||
294 | private float contactsurfacelayer = 0.001f; | 274 | private float contactsurfacelayer = 0.001f; |
295 | 275 | ||
296 | private int worldHashspaceLow = -4; | 276 | private int HashspaceLow = -5; |
297 | private int worldHashspaceHigh = 128; | 277 | private int HashspaceHigh = 12; |
298 | |||
299 | private int smallHashspaceLow = -4; | ||
300 | private int smallHashspaceHigh = 66; | ||
301 | 278 | ||
302 | private float waterlevel = 0f; | 279 | private float waterlevel = 0f; |
303 | private int framecount = 0; | 280 | private int framecount = 0; |
@@ -335,7 +312,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
335 | public bool IsAvCapsuleTilted { get; private set; } | 312 | public bool IsAvCapsuleTilted { get; private set; } |
336 | 313 | ||
337 | private float avDensity = 80f; | 314 | private float avDensity = 80f; |
338 | // private float avHeightFudgeFactor = 0.52f; | ||
339 | private float avMovementDivisorWalk = 1.3f; | 315 | private float avMovementDivisorWalk = 1.3f; |
340 | private float avMovementDivisorRun = 0.8f; | 316 | private float avMovementDivisorRun = 0.8f; |
341 | private float minimumGroundFlightOffset = 3f; | 317 | private float minimumGroundFlightOffset = 3f; |
@@ -356,13 +332,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
356 | public float bodyPIDD = 35f; | 332 | public float bodyPIDD = 35f; |
357 | public float bodyPIDG = 25; | 333 | public float bodyPIDG = 25; |
358 | 334 | ||
359 | public int geomCrossingFailuresBeforeOutofbounds = 5; | ||
360 | |||
361 | public float bodyMotorJointMaxforceTensor = 2; | ||
362 | |||
363 | public int bodyFramesAutoDisable = 20; | 335 | public int bodyFramesAutoDisable = 20; |
364 | 336 | ||
365 | private float[] _watermap; | ||
366 | private bool m_filterCollisions = true; | 337 | private bool m_filterCollisions = true; |
367 | 338 | ||
368 | private d.NearCallback nearCallback; | 339 | private d.NearCallback nearCallback; |
@@ -473,31 +444,21 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
473 | private d.Contact WaterContact; | 444 | private d.Contact WaterContact; |
474 | private d.Contact[,] m_materialContacts; | 445 | private d.Contact[,] m_materialContacts; |
475 | 446 | ||
476 | //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it | ||
477 | //Ckrinke private int m_randomizeWater = 200; | ||
478 | private int m_physicsiterations = 10; | 447 | private int m_physicsiterations = 10; |
479 | private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag | 448 | private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag |
480 | private readonly PhysicsActor PANull = new NullPhysicsActor(); | 449 | private readonly PhysicsActor PANull = new NullPhysicsActor(); |
481 | // private float step_time = 0.0f; | 450 | private float step_time = 0.0f; |
482 | //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it | ||
483 | //Ckrinke private int ms = 0; | ||
484 | public IntPtr world; | 451 | public IntPtr world; |
485 | //private bool returncollisions = false; | ||
486 | // private uint obj1LocalID = 0; | ||
487 | private uint obj2LocalID = 0; | 452 | private uint obj2LocalID = 0; |
488 | //private int ctype = 0; | ||
489 | private OdeCharacter cc1; | 453 | private OdeCharacter cc1; |
490 | private OdePrim cp1; | 454 | private OdePrim cp1; |
491 | private OdeCharacter cc2; | 455 | private OdeCharacter cc2; |
492 | private OdePrim cp2; | 456 | private OdePrim cp2; |
493 | private int p1ExpectedPoints = 0; | 457 | private int p1ExpectedPoints = 0; |
494 | private int p2ExpectedPoints = 0; | 458 | private int p2ExpectedPoints = 0; |
495 | //private int cStartStop = 0; | ||
496 | //private string cDictKey = ""; | ||
497 | 459 | ||
498 | public IntPtr space; | 460 | public IntPtr space; |
499 | 461 | ||
500 | //private IntPtr tmpSpace; | ||
501 | // split static geometry collision handling into spaces of 30 meters | 462 | // split static geometry collision handling into spaces of 30 meters |
502 | public IntPtr[,] staticPrimspace; | 463 | public IntPtr[,] staticPrimspace; |
503 | 464 | ||
@@ -535,88 +496,37 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
535 | 496 | ||
536 | private ODERayCastRequestManager m_rayCastManager; | 497 | private ODERayCastRequestManager m_rayCastManager; |
537 | 498 | ||
499 | public Scene m_frameWorkScene = null; | ||
538 | 500 | ||
539 | #region INonSharedRegionModule | 501 | public OdeScene(Scene pscene, IConfigSource psourceconfig, string pname, string pversion) |
540 | public string Name | ||
541 | { | ||
542 | get { return "OpenDynamicsEngine"; } | ||
543 | } | ||
544 | |||
545 | public Type ReplaceableInterface | ||
546 | { | ||
547 | get { return null; } | ||
548 | } | ||
549 | |||
550 | public void Initialise(IConfigSource source) | ||
551 | { | ||
552 | // TODO: Move this out of Startup | ||
553 | IConfig config = source.Configs["Startup"]; | ||
554 | if (config != null) | ||
555 | { | ||
556 | string physics = config.GetString("physics", string.Empty); | ||
557 | if (physics == Name) | ||
558 | { | ||
559 | m_Enabled = true; | ||
560 | m_config = source; | ||
561 | |||
562 | // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether | ||
563 | // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports | ||
564 | // will find it already loaded later on. | ||
565 | // | ||
566 | // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be | ||
567 | // controlled in Ode.NET.dll.config | ||
568 | if (Util.IsWindows()) | ||
569 | Util.LoadArchSpecificWindowsDll("ode.dll"); | ||
570 | |||
571 | // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to | ||
572 | // http://opensimulator.org/mantis/view.php?id=2750). | ||
573 | d.InitODE(); | ||
574 | |||
575 | } | ||
576 | } | ||
577 | |||
578 | } | ||
579 | |||
580 | public void Close() | ||
581 | { | ||
582 | } | ||
583 | |||
584 | public void AddRegion(Scene scene) | ||
585 | { | 502 | { |
586 | if (!m_Enabled) | 503 | m_config = psourceconfig; |
587 | return; | 504 | m_frameWorkScene = pscene; |
588 | 505 | ||
589 | EngineType = Name; | 506 | EngineType = pname; |
590 | PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; | 507 | PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName; |
508 | EngineName = pname + " " + pversion; | ||
591 | 509 | ||
592 | scene.RegisterModuleInterface<PhysicsScene>(this); | 510 | pscene.RegisterModuleInterface<PhysicsScene>(this); |
593 | Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); | 511 | Vector3 extent = new Vector3(pscene.RegionInfo.RegionSizeX, pscene.RegionInfo.RegionSizeY, pscene.RegionInfo.RegionSizeZ); |
594 | Initialise(extent); | 512 | Initialise(extent); |
595 | InitialiseFromConfig(m_config); | 513 | InitialiseFromConfig(m_config); |
596 | 514 | ||
597 | // This may not be that good since terrain may not be avaiable at this point | 515 | // This may not be that good since terrain may not be avaiable at this point |
598 | base.Initialise(scene.PhysicsRequestAsset, | 516 | base.Initialise(pscene.PhysicsRequestAsset, |
599 | (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[(int)(extent.X * extent.Y)]), | 517 | (pscene.Heightmap != null ? pscene.Heightmap.GetFloatsSerialised() : new float[(int)(extent.X * extent.Y)]), |
600 | (float)scene.RegionInfo.RegionSettings.WaterHeight); | 518 | (float)pscene.RegionInfo.RegionSettings.WaterHeight); |
601 | 519 | ||
602 | } | 520 | } |
603 | 521 | ||
604 | public void RemoveRegion(Scene scene) | 522 | public void RegionLoaded() |
605 | { | 523 | { |
606 | if (!m_Enabled) | 524 | mesher = m_frameWorkScene.RequestModuleInterface<IMesher>(); |
607 | return; | ||
608 | } | ||
609 | |||
610 | public void RegionLoaded(Scene scene) | ||
611 | { | ||
612 | if (!m_Enabled) | ||
613 | return; | ||
614 | |||
615 | mesher = scene.RequestModuleInterface<IMesher>(); | ||
616 | if (mesher == null) | 525 | if (mesher == null) |
617 | m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName); | 526 | m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName); |
527 | |||
528 | m_frameWorkScene.PhysicsEnabled = true; | ||
618 | } | 529 | } |
619 | #endregion | ||
620 | 530 | ||
621 | /// <summary> | 531 | /// <summary> |
622 | /// Initiailizes the scene | 532 | /// Initiailizes the scene |
@@ -625,16 +535,12 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
625 | /// </summary> | 535 | /// </summary> |
626 | private void Initialise(Vector3 regionExtent) | 536 | private void Initialise(Vector3 regionExtent) |
627 | { | 537 | { |
628 | WorldExtents.X = regionExtent.X; | 538 | WorldExtents.X = regionExtent.X; |
629 | m_regionWidth = (uint)regionExtent.X; | 539 | m_regionWidth = (uint)regionExtent.X; |
630 | WorldExtents.Y = regionExtent.Y; | 540 | WorldExtents.Y = regionExtent.Y; |
631 | m_regionHeight = (uint)regionExtent.Y; | 541 | m_regionHeight = (uint)regionExtent.Y; |
632 | 542 | ||
633 | m_suportCombine = false; | ||
634 | |||
635 | nearCallback = near; | 543 | nearCallback = near; |
636 | triCallback = TriCallback; | ||
637 | triArrayCallback = TriArrayCallback; | ||
638 | m_rayCastManager = new ODERayCastRequestManager(this); | 544 | m_rayCastManager = new ODERayCastRequestManager(this); |
639 | 545 | ||
640 | // Create the world and the first space | 546 | // Create the world and the first space |
@@ -644,33 +550,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
644 | contactgroup = d.JointGroupCreate(0); | 550 | contactgroup = d.JointGroupCreate(0); |
645 | 551 | ||
646 | d.WorldSetAutoDisableFlag(world, false); | 552 | d.WorldSetAutoDisableFlag(world, false); |
647 | |||
648 | #if USE_DRAWSTUFF | ||
649 | Thread viewthread = new Thread(new ParameterizedThreadStart(startvisualization)); | ||
650 | viewthread.Start(); | ||
651 | #endif | ||
652 | |||
653 | // _watermap = new float[258 * 258]; | ||
654 | |||
655 | // Zero out the prim spaces array (we split our space into smaller spaces so | ||
656 | // we can hit test less. | ||
657 | } | 553 | } |
658 | 554 | ||
659 | #if USE_DRAWSTUFF | ||
660 | public void startvisualization(object o) | ||
661 | { | ||
662 | ds.Functions fn; | ||
663 | fn.version = ds.VERSION; | ||
664 | fn.start = new ds.CallbackFunction(start); | ||
665 | fn.step = new ds.CallbackFunction(step); | ||
666 | fn.command = new ds.CallbackFunction(command); | ||
667 | fn.stop = null; | ||
668 | fn.path_to_textures = "./textures"; | ||
669 | string[] args = new string[0]; | ||
670 | ds.SimulationLoop(args.Length, args, 352, 288, ref fn); | ||
671 | } | ||
672 | #endif | ||
673 | |||
674 | // Initialize from configs | 555 | // Initialize from configs |
675 | private void InitialiseFromConfig(IConfigSource config) | 556 | private void InitialiseFromConfig(IConfigSource config) |
676 | { | 557 | { |
@@ -679,18 +560,9 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
679 | m_config = config; | 560 | m_config = config; |
680 | // Defaults | 561 | // Defaults |
681 | 562 | ||
682 | if (Environment.OSVersion.Platform == PlatformID.Unix) | 563 | avPIDD = 2200.0f; |
683 | { | 564 | avPIDP = 900.0f; |
684 | avPIDD = 3200.0f; | 565 | avStandupTensor = 550000f; |
685 | avPIDP = 1400.0f; | ||
686 | avStandupTensor = 2000000f; | ||
687 | } | ||
688 | else | ||
689 | { | ||
690 | avPIDD = 2200.0f; | ||
691 | avPIDP = 900.0f; | ||
692 | avStandupTensor = 550000f; | ||
693 | } | ||
694 | 566 | ||
695 | int contactsPerCollision = 80; | 567 | int contactsPerCollision = 80; |
696 | 568 | ||
@@ -714,12 +586,10 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
714 | avatarTerminalVelocity, AvatarTerminalVelocity); | 586 | avatarTerminalVelocity, AvatarTerminalVelocity); |
715 | } | 587 | } |
716 | 588 | ||
717 | worldHashspaceLow = physicsconfig.GetInt("world_hashspace_size_low", -4); | 589 | HashspaceLow = physicsconfig.GetInt("world_hashspace_level_low", -5); |
718 | worldHashspaceHigh = physicsconfig.GetInt("world_hashspace_size_high", 128); | 590 | HashspaceHigh = physicsconfig.GetInt("world_hashspace_level_high", 12); |
719 | 591 | ||
720 | metersInSpace = physicsconfig.GetFloat("meters_in_small_space", 29.9f); | 592 | metersInSpace = physicsconfig.GetFloat("meters_in_small_space", 29.9f); |
721 | smallHashspaceLow = physicsconfig.GetInt("small_hashspace_size_low", -4); | ||
722 | smallHashspaceHigh = physicsconfig.GetInt("small_hashspace_size_high", 66); | ||
723 | 593 | ||
724 | contactsurfacelayer = physicsconfig.GetFloat("world_contact_surface_layer", 0.001f); | 594 | contactsurfacelayer = physicsconfig.GetFloat("world_contact_surface_layer", 0.001f); |
725 | 595 | ||
@@ -738,7 +608,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
738 | mAvatarObjectContactBounce = physicsconfig.GetFloat("m_avatarobjectcontact_bounce", 0.1f); | 608 | mAvatarObjectContactBounce = physicsconfig.GetFloat("m_avatarobjectcontact_bounce", 0.1f); |
739 | 609 | ||
740 | ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE); | 610 | ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE); |
741 | m_physicsiterations = physicsconfig.GetInt("world_internal_steps_without_collisions", 10); | 611 | m_physicsiterations = physicsconfig.GetInt("world_solver_iterations", 10); |
742 | 612 | ||
743 | avDensity = physicsconfig.GetFloat("av_density", 80f); | 613 | avDensity = physicsconfig.GetFloat("av_density", 80f); |
744 | // avHeightFudgeFactor = physicsconfig.GetFloat("av_height_fudge_factor", 0.52f); | 614 | // avHeightFudgeFactor = physicsconfig.GetFloat("av_height_fudge_factor", 0.52f); |
@@ -754,7 +624,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
754 | 624 | ||
755 | geomContactPointsStartthrottle = physicsconfig.GetInt("geom_contactpoints_start_throttling", 5); | 625 | geomContactPointsStartthrottle = physicsconfig.GetInt("geom_contactpoints_start_throttling", 5); |
756 | geomUpdatesPerThrottledUpdate = physicsconfig.GetInt("geom_updates_before_throttled_update", 15); | 626 | geomUpdatesPerThrottledUpdate = physicsconfig.GetInt("geom_updates_before_throttled_update", 15); |
757 | geomCrossingFailuresBeforeOutofbounds = physicsconfig.GetInt("geom_crossing_failures_before_outofbounds", 5); | ||
758 | 627 | ||
759 | geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", 10.000006836f); | 628 | geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", 10.000006836f); |
760 | bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", 20); | 629 | bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", 20); |
@@ -767,29 +636,16 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
767 | meshSculptLOD = physicsconfig.GetFloat("mesh_lod", 32f); | 636 | meshSculptLOD = physicsconfig.GetFloat("mesh_lod", 32f); |
768 | MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", 16f); | 637 | MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", 16f); |
769 | m_filterCollisions = physicsconfig.GetBoolean("filter_collisions", false); | 638 | m_filterCollisions = physicsconfig.GetBoolean("filter_collisions", false); |
770 | |||
771 | |||
772 | 639 | ||
773 | if (Environment.OSVersion.Platform == PlatformID.Unix) | 640 | avPIDD = physicsconfig.GetFloat("av_pid_derivative", 2200.0f); |
774 | { | 641 | avPIDP = physicsconfig.GetFloat("av_pid_proportional", 900.0f); |
775 | avPIDD = physicsconfig.GetFloat("av_pid_derivative_linux", 2200.0f); | 642 | avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor", 550000f); |
776 | avPIDP = physicsconfig.GetFloat("av_pid_proportional_linux", 900.0f); | ||
777 | avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_linux", 550000f); | ||
778 | bodyMotorJointMaxforceTensor = physicsconfig.GetFloat("body_motor_joint_maxforce_tensor_linux", 5f); | ||
779 | } | ||
780 | else | ||
781 | { | ||
782 | avPIDD = physicsconfig.GetFloat("av_pid_derivative_win", 2200.0f); | ||
783 | avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", 900.0f); | ||
784 | avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_win", 550000f); | ||
785 | bodyMotorJointMaxforceTensor = physicsconfig.GetFloat("body_motor_joint_maxforce_tensor_win", 5f); | ||
786 | } | ||
787 | 643 | ||
788 | physics_logging = physicsconfig.GetBoolean("physics_logging", false); | 644 | physics_logging = physicsconfig.GetBoolean("physics_logging", false); |
789 | physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); | 645 | physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); |
790 | physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); | 646 | physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); |
791 | 647 | ||
792 | m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false); | 648 | // m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false); |
793 | minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f); | 649 | minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f); |
794 | maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f); | 650 | maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f); |
795 | } | 651 | } |
@@ -812,17 +668,15 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
812 | if (spaceGridMaxY > 24) | 668 | if (spaceGridMaxY > 24) |
813 | { | 669 | { |
814 | spaceGridMaxY = 24; | 670 | spaceGridMaxY = 24; |
815 | spacesPerMeterY = spaceGridMaxY / WorldExtents.Y ; | 671 | spacesPerMeterY = spaceGridMaxY / WorldExtents.Y; |
816 | } | 672 | } |
817 | 673 | ||
818 | staticPrimspace = new IntPtr[spaceGridMaxX, spaceGridMaxY]; | 674 | staticPrimspace = new IntPtr[spaceGridMaxX, spaceGridMaxY]; |
819 | 675 | ||
820 | // make this index limits | 676 | // make this index limits |
821 | spaceGridMaxX--; | 677 | spaceGridMaxX--; |
822 | spaceGridMaxY--; | 678 | spaceGridMaxY--; |
823 | 679 | ||
824 | |||
825 | |||
826 | // Centeral contact friction and bounce | 680 | // Centeral contact friction and bounce |
827 | // ckrinke 11/10/08 Enabling soft_erp but not soft_cfm until I figure out why | 681 | // ckrinke 11/10/08 Enabling soft_erp but not soft_cfm until I figure out why |
828 | // an avatar falls through in Z but not in X or Y when walking on a prim. | 682 | // an avatar falls through in Z but not in X or Y when walking on a prim. |
@@ -984,7 +838,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
984 | m_materialContacts[(int)Material.Rubber, 1].surface.soft_cfm = 0.010f; | 838 | m_materialContacts[(int)Material.Rubber, 1].surface.soft_cfm = 0.010f; |
985 | m_materialContacts[(int)Material.Rubber, 1].surface.soft_erp = 0.010f; | 839 | m_materialContacts[(int)Material.Rubber, 1].surface.soft_erp = 0.010f; |
986 | 840 | ||
987 | d.HashSpaceSetLevels(space, worldHashspaceLow, worldHashspaceHigh); | 841 | d.HashSpaceSetLevels(space, HashspaceLow, HashspaceHigh); |
988 | 842 | ||
989 | // Set the gravity,, don't disable things automatically (we set it explicitly on some things) | 843 | // Set the gravity,, don't disable things automatically (we set it explicitly on some things) |
990 | 844 | ||
@@ -997,9 +851,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
997 | d.WorldSetLinearDampingThreshold(world, 256f); | 851 | d.WorldSetLinearDampingThreshold(world, 256f); |
998 | d.WorldSetMaxAngularSpeed(world, 256f); | 852 | d.WorldSetMaxAngularSpeed(world, 256f); |
999 | 853 | ||
1000 | // Set how many steps we go without running collision testing | ||
1001 | // This is in addition to the step size. | ||
1002 | // Essentially Steps * m_physicsiterations | ||
1003 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); | 854 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); |
1004 | //d.WorldSetContactMaxCorrectingVel(world, 1000.0f); | 855 | //d.WorldSetContactMaxCorrectingVel(world, 1000.0f); |
1005 | 856 | ||
@@ -1014,22 +865,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1014 | _worldInitialized = true; | 865 | _worldInitialized = true; |
1015 | } | 866 | } |
1016 | 867 | ||
1017 | // internal void waitForSpaceUnlock(IntPtr space) | ||
1018 | // { | ||
1019 | // //if (space != IntPtr.Zero) | ||
1020 | // //while (d.SpaceLockQuery(space)) { } // Wait and do nothing | ||
1021 | // } | ||
1022 | |||
1023 | // /// <summary> | ||
1024 | // /// Debug space message for printing the space that a prim/avatar is in. | ||
1025 | // /// </summary> | ||
1026 | // /// <param name="pos"></param> | ||
1027 | // /// <returns>Returns which split up space the given position is in.</returns> | ||
1028 | // public string whichspaceamIin(Vector3 pos) | ||
1029 | // { | ||
1030 | // return calculateSpaceForGeom(pos).ToString(); | ||
1031 | // } | ||
1032 | |||
1033 | #region Collision Detection | 868 | #region Collision Detection |
1034 | 869 | ||
1035 | /// <summary> | 870 | /// <summary> |
@@ -1042,7 +877,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1042 | /// <param name='contactsArray'></param> | 877 | /// <param name='contactsArray'></param> |
1043 | /// <param name='contactGeomSize'></param> | 878 | /// <param name='contactGeomSize'></param> |
1044 | private int CollideGeoms( | 879 | private int CollideGeoms( |
1045 | IntPtr geom1, IntPtr geom2, int maxContacts, Ode.NET.d.ContactGeom[] contactsArray, int contactGeomSize) | 880 | IntPtr geom1, IntPtr geom2, int maxContacts, d.ContactGeom[] contactsArray, int contactGeomSize) |
1046 | { | 881 | { |
1047 | int count; | 882 | int count; |
1048 | 883 | ||
@@ -1113,7 +948,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1113 | { | 948 | { |
1114 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) | 949 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) |
1115 | return; | 950 | return; |
1116 | 951 | ||
1117 | // Separating static prim geometry spaces. | 952 | // Separating static prim geometry spaces. |
1118 | // We'll be calling near recursivly if one | 953 | // We'll be calling near recursivly if one |
1119 | // of them is a space to find all of the | 954 | // of them is a space to find all of the |
@@ -1155,12 +990,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1155 | name2 = "null"; | 990 | name2 = "null"; |
1156 | } | 991 | } |
1157 | 992 | ||
1158 | //if (id == d.GeomClassId.TriMeshClass) | ||
1159 | //{ | ||
1160 | // m_log.InfoFormat("near: A collision was detected between {1} and {2}", 0, name1, name2); | ||
1161 | //m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2); | ||
1162 | //} | ||
1163 | |||
1164 | // Figure out how many contact points we have | 993 | // Figure out how many contact points we have |
1165 | int count = 0; | 994 | int count = 0; |
1166 | 995 | ||
@@ -1175,7 +1004,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1175 | if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) | 1004 | if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) |
1176 | return; | 1005 | return; |
1177 | 1006 | ||
1178 | count = CollideGeoms(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf); | 1007 | count = CollideGeoms(g1, g2, contacts.Length, contacts, d.ContactGeom.unmanagedSizeOf); |
1179 | 1008 | ||
1180 | // All code after this is only relevant if we have any collisions | 1009 | // All code after this is only relevant if we have any collisions |
1181 | if (count <= 0) | 1010 | if (count <= 0) |
@@ -1198,10 +1027,10 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1198 | 1027 | ||
1199 | PhysicsActor p1; | 1028 | PhysicsActor p1; |
1200 | PhysicsActor p2; | 1029 | PhysicsActor p2; |
1201 | 1030 | ||
1202 | p1ExpectedPoints = 0; | 1031 | p1ExpectedPoints = 0; |
1203 | p2ExpectedPoints = 0; | 1032 | p2ExpectedPoints = 0; |
1204 | 1033 | ||
1205 | if (!actor_name_map.TryGetValue(g1, out p1)) | 1034 | if (!actor_name_map.TryGetValue(g1, out p1)) |
1206 | { | 1035 | { |
1207 | p1 = PANull; | 1036 | p1 = PANull; |
@@ -1238,7 +1067,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1238 | IntPtr joint; | 1067 | IntPtr joint; |
1239 | // If we're colliding with terrain, use 'TerrainContact' instead of contact. | 1068 | // If we're colliding with terrain, use 'TerrainContact' instead of contact. |
1240 | // allows us to have different settings | 1069 | // allows us to have different settings |
1241 | 1070 | ||
1242 | // We only need to test p2 for 'jump crouch purposes' | 1071 | // We only need to test p2 for 'jump crouch purposes' |
1243 | if (p2 is OdeCharacter && p1.PhysicsActorType == (int)ActorTypes.Prim) | 1072 | if (p2 is OdeCharacter && p1.PhysicsActorType == (int)ActorTypes.Prim) |
1244 | { | 1073 | { |
@@ -1252,7 +1081,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1252 | { | 1081 | { |
1253 | p2.IsColliding = true; | 1082 | p2.IsColliding = true; |
1254 | } | 1083 | } |
1255 | 1084 | ||
1256 | //if ((framecount % m_returncollisions) == 0) | 1085 | //if ((framecount % m_returncollisions) == 0) |
1257 | 1086 | ||
1258 | switch (p1.PhysicsActorType) | 1087 | switch (p1.PhysicsActorType) |
@@ -1279,110 +1108,9 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1279 | // we don't want prim or avatar to explode | 1108 | // we don't want prim or avatar to explode |
1280 | 1109 | ||
1281 | #region InterPenetration Handling - Unintended physics explosions | 1110 | #region InterPenetration Handling - Unintended physics explosions |
1282 | # region disabled code1 | ||
1283 | 1111 | ||
1284 | if (curContact.depth >= 0.08f) | 1112 | if (curContact.depth >= 0.08f) |
1285 | { | 1113 | { |
1286 | //This is disabled at the moment only because it needs more tweaking | ||
1287 | //It will eventually be uncommented | ||
1288 | /* | ||
1289 | if (contact.depth >= 1.00f) | ||
1290 | { | ||
1291 | //m_log.Debug("[PHYSICS]: " + contact.depth.ToString()); | ||
1292 | } | ||
1293 | |||
1294 | //If you interpenetrate a prim with an agent | ||
1295 | if ((p2.PhysicsActorType == (int) ActorTypes.Agent && | ||
1296 | p1.PhysicsActorType == (int) ActorTypes.Prim) || | ||
1297 | (p1.PhysicsActorType == (int) ActorTypes.Agent && | ||
1298 | p2.PhysicsActorType == (int) ActorTypes.Prim)) | ||
1299 | { | ||
1300 | |||
1301 | //contact.depth = contact.depth * 4.15f; | ||
1302 | /* | ||
1303 | if (p2.PhysicsActorType == (int) ActorTypes.Agent) | ||
1304 | { | ||
1305 | p2.CollidingObj = true; | ||
1306 | contact.depth = 0.003f; | ||
1307 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); | ||
1308 | OdeCharacter character = (OdeCharacter) p2; | ||
1309 | character.SetPidStatus(true); | ||
1310 | contact.pos = new d.Vector3(contact.pos.X + (p1.Size.X / 2), contact.pos.Y + (p1.Size.Y / 2), contact.pos.Z + (p1.Size.Z / 2)); | ||
1311 | |||
1312 | } | ||
1313 | else | ||
1314 | { | ||
1315 | |||
1316 | //contact.depth = 0.0000000f; | ||
1317 | } | ||
1318 | if (p1.PhysicsActorType == (int) ActorTypes.Agent) | ||
1319 | { | ||
1320 | |||
1321 | p1.CollidingObj = true; | ||
1322 | contact.depth = 0.003f; | ||
1323 | p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); | ||
1324 | contact.pos = new d.Vector3(contact.pos.X + (p2.Size.X / 2), contact.pos.Y + (p2.Size.Y / 2), contact.pos.Z + (p2.Size.Z / 2)); | ||
1325 | OdeCharacter character = (OdeCharacter)p1; | ||
1326 | character.SetPidStatus(true); | ||
1327 | } | ||
1328 | else | ||
1329 | { | ||
1330 | |||
1331 | //contact.depth = 0.0000000f; | ||
1332 | } | ||
1333 | |||
1334 | |||
1335 | |||
1336 | } | ||
1337 | */ | ||
1338 | // If you interpenetrate a prim with another prim | ||
1339 | /* | ||
1340 | if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) | ||
1341 | { | ||
1342 | #region disabledcode2 | ||
1343 | //OdePrim op1 = (OdePrim)p1; | ||
1344 | //OdePrim op2 = (OdePrim)p2; | ||
1345 | //op1.m_collisionscore++; | ||
1346 | //op2.m_collisionscore++; | ||
1347 | |||
1348 | //if (op1.m_collisionscore > 8000 || op2.m_collisionscore > 8000) | ||
1349 | //{ | ||
1350 | //op1.m_taintdisable = true; | ||
1351 | //AddPhysicsActorTaint(p1); | ||
1352 | //op2.m_taintdisable = true; | ||
1353 | //AddPhysicsActorTaint(p2); | ||
1354 | //} | ||
1355 | |||
1356 | //if (contact.depth >= 0.25f) | ||
1357 | //{ | ||
1358 | // Don't collide, one or both prim will expld. | ||
1359 | |||
1360 | //op1.m_interpenetrationcount++; | ||
1361 | //op2.m_interpenetrationcount++; | ||
1362 | //interpenetrations_before_disable = 200; | ||
1363 | //if (op1.m_interpenetrationcount >= interpenetrations_before_disable) | ||
1364 | //{ | ||
1365 | //op1.m_taintdisable = true; | ||
1366 | //AddPhysicsActorTaint(p1); | ||
1367 | //} | ||
1368 | //if (op2.m_interpenetrationcount >= interpenetrations_before_disable) | ||
1369 | //{ | ||
1370 | // op2.m_taintdisable = true; | ||
1371 | //AddPhysicsActorTaint(p2); | ||
1372 | //} | ||
1373 | |||
1374 | //contact.depth = contact.depth / 8f; | ||
1375 | //contact.normal = new d.Vector3(0, 0, 1); | ||
1376 | //} | ||
1377 | //if (op1.m_disabled || op2.m_disabled) | ||
1378 | //{ | ||
1379 | //Manually disabled objects stay disabled | ||
1380 | //contact.depth = 0f; | ||
1381 | //} | ||
1382 | #endregion | ||
1383 | } | ||
1384 | */ | ||
1385 | #endregion | ||
1386 | if (curContact.depth >= 1.00f) | 1114 | if (curContact.depth >= 1.00f) |
1387 | { | 1115 | { |
1388 | //m_log.Info("[P]: " + contact.depth.ToString()); | 1116 | //m_log.Info("[P]: " + contact.depth.ToString()); |
@@ -1432,7 +1160,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1432 | 1160 | ||
1433 | // Logic for collision handling | 1161 | // Logic for collision handling |
1434 | // Note, that if *all* contacts are skipped (VolumeDetect) | 1162 | // Note, that if *all* contacts are skipped (VolumeDetect) |
1435 | // The prim still detects (and forwards) collision events but | 1163 | // The prim still detects (and forwards) collision events but |
1436 | // appears to be phantom for the world | 1164 | // appears to be phantom for the world |
1437 | Boolean skipThisContact = false; | 1165 | Boolean skipThisContact = false; |
1438 | 1166 | ||
@@ -1507,10 +1235,10 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1507 | material = ((OdePrim) p2).m_material; | 1235 | material = ((OdePrim) p2).m_material; |
1508 | p2ExpectedPoints = ((OdePrim)p2).ExpectedCollisionContacts; | 1236 | p2ExpectedPoints = ((OdePrim)p2).ExpectedCollisionContacts; |
1509 | } | 1237 | } |
1510 | 1238 | ||
1511 | // Unnessesary because p1 is defined above | 1239 | // Unnessesary because p1 is defined above |
1512 | //if (p1 is OdePrim) | 1240 | //if (p1 is OdePrim) |
1513 | // { | 1241 | // { |
1514 | // p1ExpectedPoints = ((OdePrim)p1).ExpectedCollisionContacts; | 1242 | // p1ExpectedPoints = ((OdePrim)p1).ExpectedCollisionContacts; |
1515 | // } | 1243 | // } |
1516 | //m_log.DebugFormat("Material: {0}", material); | 1244 | //m_log.DebugFormat("Material: {0}", material); |
@@ -1622,7 +1350,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1622 | material = ((OdePrim)p2).m_material; | 1350 | material = ((OdePrim)p2).m_material; |
1623 | p2ExpectedPoints = ((OdePrim)p2).ExpectedCollisionContacts; | 1351 | p2ExpectedPoints = ((OdePrim)p2).ExpectedCollisionContacts; |
1624 | } | 1352 | } |
1625 | 1353 | ||
1626 | //m_log.DebugFormat("Material: {0}", material); | 1354 | //m_log.DebugFormat("Material: {0}", material); |
1627 | m_materialContacts[material, 0].geom = curContact; | 1355 | m_materialContacts[material, 0].geom = curContact; |
1628 | 1356 | ||
@@ -1642,7 +1370,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1642 | } | 1370 | } |
1643 | 1371 | ||
1644 | collision_accounting_events(p1, p2, maxDepthContact); | 1372 | collision_accounting_events(p1, p2, maxDepthContact); |
1645 | 1373 | ||
1646 | if (count > ((p1ExpectedPoints + p2ExpectedPoints) * 0.25) + (geomContactPointsStartthrottle)) | 1374 | if (count > ((p1ExpectedPoints + p2ExpectedPoints) * 0.25) + (geomContactPointsStartthrottle)) |
1647 | { | 1375 | { |
1648 | // If there are more then 3 contact points, it's likely | 1376 | // If there are more then 3 contact points, it's likely |
@@ -1678,31 +1406,13 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1678 | { | 1406 | { |
1679 | if (Math.Abs(contact.depth - contactGeom.depth) < 0.052f) | 1407 | if (Math.Abs(contact.depth - contactGeom.depth) < 0.052f) |
1680 | { | 1408 | { |
1681 | //contactGeom.depth *= .00005f; | 1409 | result = true; |
1682 | //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth)); | 1410 | break; |
1683 | // m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z)); | ||
1684 | result = true; | ||
1685 | break; | ||
1686 | } | 1411 | } |
1687 | // else | ||
1688 | // { | ||
1689 | // //m_log.DebugFormat("[Collsion]: Depth {0}", Math.Abs(contact.depth - contactGeom.depth)); | ||
1690 | // } | ||
1691 | } | 1412 | } |
1692 | // else | 1413 | } |
1693 | // { | ||
1694 | // //m_log.DebugFormat("[Collision]: <{0},{1},{2}>", Math.Abs(contactGeom.normal.X - contact.normal.X), Math.Abs(contactGeom.normal.Y - contact.normal.Y), Math.Abs(contactGeom.normal.Z - contact.normal.Z)); | ||
1695 | // //int i = 0; | ||
1696 | // } | ||
1697 | } | ||
1698 | else if (at == ActorTypes.Prim) | 1414 | else if (at == ActorTypes.Prim) |
1699 | { | 1415 | { |
1700 | //d.AABB aabb1 = new d.AABB(); | ||
1701 | //d.AABB aabb2 = new d.AABB(); | ||
1702 | |||
1703 | //d.GeomGetAABB(contactGeom.g2, out aabb2); | ||
1704 | //d.GeomGetAABB(contactGeom.g1, out aabb1); | ||
1705 | //aabb1. | ||
1706 | if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f))) | 1416 | if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f))) |
1707 | { | 1417 | { |
1708 | if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z) | 1418 | if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z) |
@@ -1729,9 +1439,28 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1729 | obj2LocalID = 0; | 1439 | obj2LocalID = 0; |
1730 | //ctype = 0; | 1440 | //ctype = 0; |
1731 | //cStartStop = 0; | 1441 | //cStartStop = 0; |
1732 | if (!p2.SubscribedEvents() && !p1.SubscribedEvents()) | 1442 | // if (!p2.SubscribedEvents() && !p1.SubscribedEvents()) |
1443 | // return; | ||
1444 | bool p1events = p1.SubscribedEvents(); | ||
1445 | bool p2events = p2.SubscribedEvents(); | ||
1446 | |||
1447 | if (p1.IsVolumeDtc) | ||
1448 | p2events = false; | ||
1449 | if (p2.IsVolumeDtc) | ||
1450 | p1events = false; | ||
1451 | |||
1452 | if (!p2events && !p1events) | ||
1733 | return; | 1453 | return; |
1734 | 1454 | ||
1455 | Vector3 vel = Vector3.Zero; | ||
1456 | if (p2 != null && p2.IsPhysical) | ||
1457 | vel = p2.Velocity; | ||
1458 | |||
1459 | if (p1 != null && p1.IsPhysical) | ||
1460 | vel -= p1.Velocity; | ||
1461 | |||
1462 | contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal); | ||
1463 | |||
1735 | switch ((ActorTypes)p2.PhysicsActorType) | 1464 | switch ((ActorTypes)p2.PhysicsActorType) |
1736 | { | 1465 | { |
1737 | case ActorTypes.Agent: | 1466 | case ActorTypes.Agent: |
@@ -1744,14 +1473,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1744 | cc1 = (OdeCharacter)p1; | 1473 | cc1 = (OdeCharacter)p1; |
1745 | obj2LocalID = cc1.LocalID; | 1474 | obj2LocalID = cc1.LocalID; |
1746 | cc1.AddCollisionEvent(cc2.LocalID, contact); | 1475 | cc1.AddCollisionEvent(cc2.LocalID, contact); |
1747 | //ctype = (int)CollisionCategories.Character; | ||
1748 | |||
1749 | //if (cc1.CollidingObj) | ||
1750 | //cStartStop = (int)StatusIndicators.Generic; | ||
1751 | //else | ||
1752 | //cStartStop = (int)StatusIndicators.Start; | ||
1753 | |||
1754 | //returncollisions = true; | ||
1755 | break; | 1476 | break; |
1756 | 1477 | ||
1757 | case ActorTypes.Prim: | 1478 | case ActorTypes.Prim: |
@@ -1761,21 +1482,11 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1761 | obj2LocalID = cp1.LocalID; | 1482 | obj2LocalID = cp1.LocalID; |
1762 | cp1.AddCollisionEvent(cc2.LocalID, contact); | 1483 | cp1.AddCollisionEvent(cc2.LocalID, contact); |
1763 | } | 1484 | } |
1764 | //ctype = (int)CollisionCategories.Geom; | ||
1765 | |||
1766 | //if (cp1.CollidingObj) | ||
1767 | //cStartStop = (int)StatusIndicators.Generic; | ||
1768 | //else | ||
1769 | //cStartStop = (int)StatusIndicators.Start; | ||
1770 | |||
1771 | //returncollisions = true; | ||
1772 | break; | 1485 | break; |
1773 | 1486 | ||
1774 | case ActorTypes.Ground: | 1487 | case ActorTypes.Ground: |
1775 | case ActorTypes.Unknown: | 1488 | case ActorTypes.Unknown: |
1776 | obj2LocalID = 0; | 1489 | obj2LocalID = 0; |
1777 | //ctype = (int)CollisionCategories.Land; | ||
1778 | //returncollisions = true; | ||
1779 | break; | 1490 | break; |
1780 | } | 1491 | } |
1781 | 1492 | ||
@@ -1797,13 +1508,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1797 | cc1 = (OdeCharacter) p1; | 1508 | cc1 = (OdeCharacter) p1; |
1798 | obj2LocalID = cc1.LocalID; | 1509 | obj2LocalID = cc1.LocalID; |
1799 | cc1.AddCollisionEvent(cp2.LocalID, contact); | 1510 | cc1.AddCollisionEvent(cp2.LocalID, contact); |
1800 | //ctype = (int)CollisionCategories.Character; | ||
1801 | |||
1802 | //if (cc1.CollidingObj) | ||
1803 | //cStartStop = (int)StatusIndicators.Generic; | ||
1804 | //else | ||
1805 | //cStartStop = (int)StatusIndicators.Start; | ||
1806 | //returncollisions = true; | ||
1807 | } | 1511 | } |
1808 | break; | 1512 | break; |
1809 | case ActorTypes.Prim: | 1513 | case ActorTypes.Prim: |
@@ -1813,23 +1517,12 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1813 | cp1 = (OdePrim) p1; | 1517 | cp1 = (OdePrim) p1; |
1814 | obj2LocalID = cp1.LocalID; | 1518 | obj2LocalID = cp1.LocalID; |
1815 | cp1.AddCollisionEvent(cp2.LocalID, contact); | 1519 | cp1.AddCollisionEvent(cp2.LocalID, contact); |
1816 | //ctype = (int)CollisionCategories.Geom; | ||
1817 | |||
1818 | //if (cp1.CollidingObj) | ||
1819 | //cStartStop = (int)StatusIndicators.Generic; | ||
1820 | //else | ||
1821 | //cStartStop = (int)StatusIndicators.Start; | ||
1822 | |||
1823 | //returncollisions = true; | ||
1824 | } | 1520 | } |
1825 | break; | 1521 | break; |
1826 | 1522 | ||
1827 | case ActorTypes.Ground: | 1523 | case ActorTypes.Ground: |
1828 | case ActorTypes.Unknown: | 1524 | case ActorTypes.Unknown: |
1829 | obj2LocalID = 0; | 1525 | obj2LocalID = 0; |
1830 | //ctype = (int)CollisionCategories.Land; | ||
1831 | |||
1832 | //returncollisions = true; | ||
1833 | break; | 1526 | break; |
1834 | } | 1527 | } |
1835 | 1528 | ||
@@ -1837,80 +1530,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1837 | } | 1530 | } |
1838 | break; | 1531 | break; |
1839 | } | 1532 | } |
1840 | //if (returncollisions) | ||
1841 | //{ | ||
1842 | |||
1843 | //lock (m_storedCollisions) | ||
1844 | //{ | ||
1845 | //cDictKey = obj1LocalID.ToString() + obj2LocalID.ToString() + cStartStop.ToString() + ctype.ToString(); | ||
1846 | //if (m_storedCollisions.ContainsKey(cDictKey)) | ||
1847 | //{ | ||
1848 | //sCollisionData objd = m_storedCollisions[cDictKey]; | ||
1849 | //objd.NumberOfCollisions += 1; | ||
1850 | //objd.lastframe = framecount; | ||
1851 | //m_storedCollisions[cDictKey] = objd; | ||
1852 | //} | ||
1853 | //else | ||
1854 | //{ | ||
1855 | //sCollisionData objd = new sCollisionData(); | ||
1856 | //objd.ColliderLocalId = obj1LocalID; | ||
1857 | //objd.CollidedWithLocalId = obj2LocalID; | ||
1858 | //objd.CollisionType = ctype; | ||
1859 | //objd.NumberOfCollisions = 1; | ||
1860 | //objd.lastframe = framecount; | ||
1861 | //objd.StatusIndicator = cStartStop; | ||
1862 | //m_storedCollisions.Add(cDictKey, objd); | ||
1863 | //} | ||
1864 | //} | ||
1865 | // } | ||
1866 | } | ||
1867 | |||
1868 | private int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount) | ||
1869 | { | ||
1870 | /* String name1 = null; | ||
1871 | String name2 = null; | ||
1872 | |||
1873 | if (!geom_name_map.TryGetValue(trimesh, out name1)) | ||
1874 | { | ||
1875 | name1 = "null"; | ||
1876 | } | ||
1877 | if (!geom_name_map.TryGetValue(refObject, out name2)) | ||
1878 | { | ||
1879 | name2 = "null"; | ||
1880 | } | ||
1881 | |||
1882 | m_log.InfoFormat("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2); | ||
1883 | */ | ||
1884 | return 1; | ||
1885 | } | ||
1886 | |||
1887 | private int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex) | ||
1888 | { | ||
1889 | // String name1 = null; | ||
1890 | // String name2 = null; | ||
1891 | // | ||
1892 | // if (!geom_name_map.TryGetValue(trimesh, out name1)) | ||
1893 | // { | ||
1894 | // name1 = "null"; | ||
1895 | // } | ||
1896 | // | ||
1897 | // if (!geom_name_map.TryGetValue(refObject, out name2)) | ||
1898 | // { | ||
1899 | // name2 = "null"; | ||
1900 | // } | ||
1901 | |||
1902 | // m_log.InfoFormat("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex); | ||
1903 | |||
1904 | d.Vector3 v0 = new d.Vector3(); | ||
1905 | d.Vector3 v1 = new d.Vector3(); | ||
1906 | d.Vector3 v2 = new d.Vector3(); | ||
1907 | |||
1908 | d.GeomTriMeshGetTriangle(trimesh, 0, ref v0, ref v1, ref v2); | ||
1909 | // m_log.DebugFormat("Triangle {0} is <{1},{2},{3}>, <{4},{5},{6}>, <{7},{8},{9}>", triangleIndex, v0.X, v0.Y, v0.Z, v1.X, v1.Y, v1.Z, v2.X, v2.Y, v2.Z); | ||
1910 | |||
1911 | return 1; | ||
1912 | } | 1533 | } |
1913 | |||
1914 | /// <summary> | 1534 | /// <summary> |
1915 | /// This is our collision testing routine in ODE | 1535 | /// This is our collision testing routine in ODE |
1916 | /// </summary> | 1536 | /// </summary> |
@@ -1924,11 +1544,11 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1924 | // since we don't know if we're colliding yet | 1544 | // since we don't know if we're colliding yet |
1925 | if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero) | 1545 | if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero) |
1926 | continue; | 1546 | continue; |
1927 | 1547 | ||
1928 | chr.IsColliding = false; | 1548 | chr.IsColliding = false; |
1929 | chr.CollidingGround = false; | 1549 | chr.CollidingGround = false; |
1930 | chr.CollidingObj = false; | 1550 | chr.CollidingObj = false; |
1931 | 1551 | ||
1932 | // Test the avatar's geometry for collision with the space | 1552 | // Test the avatar's geometry for collision with the space |
1933 | // This will return near and the space that they are the closest to | 1553 | // This will return near and the space that they are the closest to |
1934 | // And we'll run this again against the avatar and the space segment | 1554 | // And we'll run this again against the avatar and the space segment |
@@ -1942,7 +1562,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1942 | { | 1562 | { |
1943 | m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", PhysicsSceneName); | 1563 | m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", PhysicsSceneName); |
1944 | } | 1564 | } |
1945 | 1565 | ||
1946 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); | 1566 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); |
1947 | //if (chr.Position.Z + (chr.Velocity.Z * timeStep) < terrainheight + 10) | 1567 | //if (chr.Position.Z + (chr.Velocity.Z * timeStep) < terrainheight + 10) |
1948 | //{ | 1568 | //{ |
@@ -2003,15 +1623,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2003 | 1623 | ||
2004 | #endregion | 1624 | #endregion |
2005 | 1625 | ||
2006 | public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) | ||
2007 | { | ||
2008 | if (!m_suportCombine) | ||
2009 | return; | ||
2010 | m_worldOffset = offset; | ||
2011 | WorldExtents = new Vector2(extents.X, extents.Y); | ||
2012 | m_parentScene = pScene; | ||
2013 | } | ||
2014 | |||
2015 | // Recovered for use by fly height. Kitto Flora | 1626 | // Recovered for use by fly height. Kitto Flora |
2016 | internal float GetTerrainHeightAtXY(float x, float y) | 1627 | internal float GetTerrainHeightAtXY(float x, float y) |
2017 | { | 1628 | { |
@@ -2019,12 +1630,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2019 | int offsetX = 0; | 1630 | int offsetX = 0; |
2020 | int offsetY = 0; | 1631 | int offsetY = 0; |
2021 | 1632 | ||
2022 | if (m_suportCombine) | ||
2023 | { | ||
2024 | offsetX = ((int)(x / (int)Constants.RegionSize)) * (int)Constants.RegionSize; | ||
2025 | offsetY = ((int)(y / (int)Constants.RegionSize)) * (int)Constants.RegionSize; | ||
2026 | } | ||
2027 | |||
2028 | if(RegionTerrain.TryGetValue(new Vector3(offsetX,offsetY,0), out heightFieldGeom)) | 1633 | if(RegionTerrain.TryGetValue(new Vector3(offsetX,offsetY,0), out heightFieldGeom)) |
2029 | { | 1634 | { |
2030 | if (heightFieldGeom != IntPtr.Zero) | 1635 | if (heightFieldGeom != IntPtr.Zero) |
@@ -2042,14 +1647,15 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2042 | x = x - offsetX + 1f; | 1647 | x = x - offsetX + 1f; |
2043 | y = y - offsetY + 1f; | 1648 | y = y - offsetY + 1f; |
2044 | 1649 | ||
2045 | index = (int)((int)x * ((int)m_regionHeight +3) + (int)y); | 1650 | // map is rotated |
1651 | index = (int)x * ((int)m_regionHeight + 3) + (int)y; | ||
2046 | 1652 | ||
2047 | if (index < TerrainHeightFieldHeights[heightFieldGeom].Length) | 1653 | if (index < TerrainHeightFieldHeights[heightFieldGeom].Length) |
2048 | { | 1654 | { |
2049 | //m_log.DebugFormat("x{0} y{1} = {2}", x, y, (float)TerrainHeightFieldHeights[heightFieldGeom][index]); | 1655 | //m_log.DebugFormat("x{0} y{1} = {2}", x, y, (float)TerrainHeightFieldHeights[heightFieldGeom][index]); |
2050 | return (float)TerrainHeightFieldHeights[heightFieldGeom][index]; | 1656 | return (float)TerrainHeightFieldHeights[heightFieldGeom][index]; |
2051 | } | 1657 | } |
2052 | 1658 | ||
2053 | else | 1659 | else |
2054 | return 0f; | 1660 | return 0f; |
2055 | } | 1661 | } |
@@ -2069,7 +1675,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2069 | { | 1675 | { |
2070 | return 0f; | 1676 | return 0f; |
2071 | } | 1677 | } |
2072 | } | 1678 | } |
2073 | // End recovered. Kitto Flora | 1679 | // End recovered. Kitto Flora |
2074 | 1680 | ||
2075 | /// <summary> | 1681 | /// <summary> |
@@ -2079,7 +1685,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2079 | internal void AddCollisionEventReporting(PhysicsActor obj) | 1685 | internal void AddCollisionEventReporting(PhysicsActor obj) |
2080 | { | 1686 | { |
2081 | // m_log.DebugFormat("[PHYSICS]: Adding {0} {1} to collision event reporting", obj.SOPName, obj.LocalID); | 1687 | // m_log.DebugFormat("[PHYSICS]: Adding {0} {1} to collision event reporting", obj.SOPName, obj.LocalID); |
2082 | 1688 | ||
2083 | lock (m_collisionEventActorsChanges) | 1689 | lock (m_collisionEventActorsChanges) |
2084 | m_collisionEventActorsChanges[obj.LocalID] = obj; | 1690 | m_collisionEventActorsChanges[obj.LocalID] = obj; |
2085 | } | 1691 | } |
@@ -2099,7 +1705,9 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2099 | #region Add/Remove Entities | 1705 | #region Add/Remove Entities |
2100 | 1706 | ||
2101 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) | 1707 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) |
2102 | { | 1708 | { |
1709 | d.AllocateODEDataForThread(0); | ||
1710 | |||
2103 | OdeCharacter newAv | 1711 | OdeCharacter newAv |
2104 | = new OdeCharacter( | 1712 | = new OdeCharacter( |
2105 | avName, this, position, velocity, size, avPIDD, avPIDP, | 1713 | avName, this, position, velocity, size, avPIDD, avPIDP, |
@@ -2119,7 +1727,12 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2119 | // "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}", | 1727 | // "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}", |
2120 | // actor.Name, actor.LocalID, Name); | 1728 | // actor.Name, actor.LocalID, Name); |
2121 | 1729 | ||
2122 | ((OdeCharacter) actor).Destroy(); | 1730 | lock (OdeLock) |
1731 | { | ||
1732 | d.AllocateODEDataForThread(0); | ||
1733 | |||
1734 | ((OdeCharacter) actor).Destroy(); | ||
1735 | } | ||
2123 | } | 1736 | } |
2124 | 1737 | ||
2125 | internal void AddCharacter(OdeCharacter chr) | 1738 | internal void AddCharacter(OdeCharacter chr) |
@@ -2169,9 +1782,11 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2169 | Vector3 siz = size; | 1782 | Vector3 siz = size; |
2170 | Quaternion rot = rotation; | 1783 | Quaternion rot = rotation; |
2171 | 1784 | ||
1785 | |||
2172 | OdePrim newPrim; | 1786 | OdePrim newPrim; |
2173 | lock (OdeLock) | 1787 | lock (OdeLock) |
2174 | { | 1788 | { |
1789 | d.AllocateODEDataForThread(0); | ||
2175 | newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical); | 1790 | newPrim = new OdePrim(name, this, pos, siz, rot, pbs, isphysical); |
2176 | 1791 | ||
2177 | lock (_prims) | 1792 | lock (_prims) |
@@ -2456,7 +2071,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2456 | 2071 | ||
2457 | lock (externalJointRequestsLock) | 2072 | lock (externalJointRequestsLock) |
2458 | { | 2073 | { |
2459 | if (!requestedJointsToBeCreated.Contains(joint)) // forbid same creation request from entering twice | 2074 | if (!requestedJointsToBeCreated.Contains(joint)) // forbid same creation request from entering twice |
2460 | { | 2075 | { |
2461 | requestedJointsToBeCreated.Add(joint); | 2076 | requestedJointsToBeCreated.Add(joint); |
2462 | } | 2077 | } |
@@ -2620,59 +2235,13 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2620 | 2235 | ||
2621 | 2236 | ||
2622 | } | 2237 | } |
2623 | // we don't want to remove the main space | ||
2624 | |||
2625 | // If the geometry is in the targetspace, remove it from the target space | ||
2626 | //m_log.Warn(prim.m_targetSpace); | ||
2627 | |||
2628 | //if (prim.m_targetSpace != IntPtr.Zero) | ||
2629 | //{ | ||
2630 | //if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom)) | ||
2631 | //{ | ||
2632 | |||
2633 | //if (d.GeomIsSpace(prim.m_targetSpace)) | ||
2634 | //{ | ||
2635 | //waitForSpaceUnlock(prim.m_targetSpace); | ||
2636 | //d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); | ||
2637 | prim.m_targetSpace = IntPtr.Zero; | 2238 | prim.m_targetSpace = IntPtr.Zero; |
2638 | //} | ||
2639 | //else | ||
2640 | //{ | ||
2641 | // m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + | ||
2642 | //((OdePrim)prim).m_targetSpace.ToString()); | ||
2643 | //} | ||
2644 | |||
2645 | //} | ||
2646 | //} | ||
2647 | //m_log.Warn(prim.prim_geom); | ||
2648 | |||
2649 | if (!prim.RemoveGeom()) | 2239 | if (!prim.RemoveGeom()) |
2650 | m_log.Warn("[ODE SCENE]: Unable to remove prim from physics scene"); | 2240 | m_log.Warn("[ODE SCENE]: Unable to remove prim from physics scene"); |
2651 | 2241 | ||
2652 | lock (_prims) | 2242 | lock (_prims) |
2653 | _prims.Remove(prim); | 2243 | _prims.Remove(prim); |
2654 | 2244 | ||
2655 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore | ||
2656 | //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) | ||
2657 | //{ | ||
2658 | //if (prim.m_targetSpace != null) | ||
2659 | //{ | ||
2660 | //if (d.GeomIsSpace(prim.m_targetSpace)) | ||
2661 | //{ | ||
2662 | //waitForSpaceUnlock(prim.m_targetSpace); | ||
2663 | //d.SpaceRemove(space, prim.m_targetSpace); | ||
2664 | // free up memory used by the space. | ||
2665 | //d.SpaceDestroy(prim.m_targetSpace); | ||
2666 | //int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position); | ||
2667 | //resetSpaceArrayItemToZero(xyspace[0], xyspace[1]); | ||
2668 | //} | ||
2669 | //else | ||
2670 | //{ | ||
2671 | //m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + | ||
2672 | //((OdePrim) prim).m_targetSpace.ToString()); | ||
2673 | //} | ||
2674 | //} | ||
2675 | //} | ||
2676 | 2245 | ||
2677 | if (SupportsNINJAJoints) | 2246 | if (SupportsNINJAJoints) |
2678 | RemoveAllJointsConnectedToActorThreadLocked(prim); | 2247 | RemoveAllJointsConnectedToActorThreadLocked(prim); |
@@ -2768,12 +2337,9 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2768 | { | 2337 | { |
2769 | if (d.GeomIsSpace(currentspace)) | 2338 | if (d.GeomIsSpace(currentspace)) |
2770 | { | 2339 | { |
2771 | // waitForSpaceUnlock(currentspace); | ||
2772 | // waitForSpaceUnlock(space); | ||
2773 | d.SpaceRemove(space, currentspace); | 2340 | d.SpaceRemove(space, currentspace); |
2774 | // free up memory used by the space. | 2341 | // free up memory used by the space. |
2775 | 2342 | ||
2776 | //d.SpaceDestroy(currentspace); | ||
2777 | resetSpaceArrayItemToZero(currentspace); | 2343 | resetSpaceArrayItemToZero(currentspace); |
2778 | } | 2344 | } |
2779 | else | 2345 | else |
@@ -2831,7 +2397,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2831 | if (newspace == IntPtr.Zero) | 2397 | if (newspace == IntPtr.Zero) |
2832 | { | 2398 | { |
2833 | newspace = createprimspace(iprimspaceArrItem[0], iprimspaceArrItem[1]); | 2399 | newspace = createprimspace(iprimspaceArrItem[0], iprimspaceArrItem[1]); |
2834 | d.HashSpaceSetLevels(newspace, smallHashspaceLow, smallHashspaceHigh); | 2400 | d.HashSpaceSetLevels(newspace, HashspaceLow, HashspaceHigh); |
2835 | } | 2401 | } |
2836 | 2402 | ||
2837 | return newspace; | 2403 | return newspace; |
@@ -2851,7 +2417,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2851 | // waitForSpaceUnlock(space); | 2417 | // waitForSpaceUnlock(space); |
2852 | d.SpaceSetSublevel(space, 1); | 2418 | d.SpaceSetSublevel(space, 1); |
2853 | d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]); | 2419 | d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]); |
2854 | 2420 | ||
2855 | return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; | 2421 | return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; |
2856 | } | 2422 | } |
2857 | 2423 | ||
@@ -2948,7 +2514,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2948 | iPropertiesNotSupportedDefault++; | 2514 | iPropertiesNotSupportedDefault++; |
2949 | 2515 | ||
2950 | if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) | 2516 | if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) |
2951 | iPropertiesNotSupportedDefault++; | 2517 | iPropertiesNotSupportedDefault++; |
2952 | 2518 | ||
2953 | if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) | 2519 | if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) |
2954 | iPropertiesNotSupportedDefault++; | 2520 | iPropertiesNotSupportedDefault++; |
@@ -3021,7 +2587,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3021 | #if SPAM | 2587 | #if SPAM |
3022 | m_log.Debug("Mesh"); | 2588 | m_log.Debug("Mesh"); |
3023 | #endif | 2589 | #endif |
3024 | return true; | 2590 | return true; |
3025 | } | 2591 | } |
3026 | 2592 | ||
3027 | /// <summary> | 2593 | /// <summary> |
@@ -3052,6 +2618,49 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3052 | } | 2618 | } |
3053 | } | 2619 | } |
3054 | 2620 | ||
2621 | // does all pending changes generated during region load process | ||
2622 | public override void ProcessPreSimulation() | ||
2623 | { | ||
2624 | lock (OdeLock) | ||
2625 | { | ||
2626 | if (world == IntPtr.Zero) | ||
2627 | { | ||
2628 | _taintedPrims.Clear();; | ||
2629 | return; | ||
2630 | } | ||
2631 | |||
2632 | int donechanges = 0; | ||
2633 | if (_taintedPrims.Count > 0) | ||
2634 | { | ||
2635 | |||
2636 | m_log.InfoFormat("[Ode] start processing pending actor operations"); | ||
2637 | int tstart = Util.EnvironmentTickCount(); | ||
2638 | |||
2639 | d.AllocateODEDataForThread(0); | ||
2640 | |||
2641 | lock (_taintedPrims) | ||
2642 | { | ||
2643 | foreach (OdePrim prim in _taintedPrims) | ||
2644 | { | ||
2645 | if (prim.m_taintremove) | ||
2646 | RemovePrimThreadLocked(prim); | ||
2647 | else | ||
2648 | prim.ProcessTaints(); | ||
2649 | |||
2650 | prim.m_collisionscore = 0; | ||
2651 | donechanges++; | ||
2652 | } | ||
2653 | _taintedPrims.Clear(); | ||
2654 | } | ||
2655 | |||
2656 | int time = Util.EnvironmentTickCountSubtract(tstart); | ||
2657 | m_log.InfoFormat("[Ode] finished {0} operations in {1}ms", donechanges, time); | ||
2658 | } | ||
2659 | m_log.InfoFormat("[Ode] {0} prim actors loaded",_prims.Count); | ||
2660 | } | ||
2661 | } | ||
2662 | |||
2663 | |||
3055 | /// <summary> | 2664 | /// <summary> |
3056 | /// This is our main simulate loop | 2665 | /// This is our main simulate loop |
3057 | /// </summary> | 2666 | /// </summary> |
@@ -3065,7 +2674,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3065 | /// <returns>The number of frames simulated over that period.</returns> | 2674 | /// <returns>The number of frames simulated over that period.</returns> |
3066 | public override float Simulate(float timeStep) | 2675 | public override float Simulate(float timeStep) |
3067 | { | 2676 | { |
3068 | if (!_worldInitialized) return 11f; | 2677 | if (!_worldInitialized) |
2678 | return 1.0f; | ||
3069 | 2679 | ||
3070 | int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; | 2680 | int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; |
3071 | int tempTick = 0, tempTick2 = 0; | 2681 | int tempTick = 0, tempTick2 = 0; |
@@ -3077,26 +2687,12 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3077 | 2687 | ||
3078 | float fps = 0; | 2688 | float fps = 0; |
3079 | 2689 | ||
3080 | float timeLeft = timeStep; | 2690 | step_time += timeStep; |
3081 | 2691 | ||
3082 | //m_log.Info(timeStep.ToString()); | 2692 | float HalfOdeStep = ODE_STEPSIZE * 0.5f; |
3083 | // step_time += timeSte | 2693 | if (step_time < HalfOdeStep) |
3084 | // | 2694 | return 0; |
3085 | // // If We're loaded down by something else, | 2695 | |
3086 | // // or debugging with the Visual Studio project on pause | ||
3087 | // // skip a few frames to catch up gracefully. | ||
3088 | // // without shooting the physicsactors all over the place | ||
3089 | // | ||
3090 | // if (step_time >= m_SkipFramesAtms) | ||
3091 | // { | ||
3092 | // // Instead of trying to catch up, it'll do 5 physics frames only | ||
3093 | // step_time = ODE_STEPSIZE; | ||
3094 | // m_physicsiterations = 5; | ||
3095 | // } | ||
3096 | // else | ||
3097 | // { | ||
3098 | // m_physicsiterations = 10; | ||
3099 | // } | ||
3100 | 2696 | ||
3101 | // We change _collisionEventPrimChanges to avoid locking _collisionEventPrim itself and causing potential | 2697 | // We change _collisionEventPrimChanges to avoid locking _collisionEventPrim itself and causing potential |
3102 | // deadlock if the collision event tries to lock something else later on which is already locked by a | 2698 | // deadlock if the collision event tries to lock something else later on which is already locked by a |
@@ -3120,29 +2716,12 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3120 | CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks | 2716 | CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks |
3121 | } | 2717 | } |
3122 | 2718 | ||
2719 | |||
3123 | lock (OdeLock) | 2720 | lock (OdeLock) |
3124 | { | 2721 | { |
3125 | // Process 10 frames if the sim is running normal.. | 2722 | d.AllocateODEDataForThread(~0U); |
3126 | // process 5 frames if the sim is running slow | ||
3127 | //try | ||
3128 | //{ | ||
3129 | //d.WorldSetQuickStepNumIterations(world, m_physicsiterations); | ||
3130 | //} | ||
3131 | //catch (StackOverflowException) | ||
3132 | //{ | ||
3133 | // m_log.Error("[PHYSICS]: The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim."); | ||
3134 | // ode.drelease(world); | ||
3135 | //base.TriggerPhysicsBasedRestart(); | ||
3136 | //} | ||
3137 | 2723 | ||
3138 | // Figure out the Frames Per Second we're going at. | 2724 | while (step_time > HalfOdeStep) |
3139 | //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size | ||
3140 | |||
3141 | fps = (timeStep / ODE_STEPSIZE) * 1000; | ||
3142 | // HACK: Using a time dilation of 1.0 to debug rubberbanding issues | ||
3143 | //m_timeDilation = Math.Min((step_time / ODE_STEPSIZE) / (0.09375f / ODE_STEPSIZE), 1.0f); | ||
3144 | |||
3145 | while (timeLeft > 0.0f) | ||
3146 | { | 2725 | { |
3147 | try | 2726 | try |
3148 | { | 2727 | { |
@@ -3241,10 +2820,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3241 | tempTick = tempTick2; | 2820 | tempTick = tempTick2; |
3242 | } | 2821 | } |
3243 | 2822 | ||
3244 | //if ((framecount % m_randomizeWater) == 0) | ||
3245 | // randomizeWater(waterlevel); | ||
3246 | |||
3247 | //int RayCastTimeMS = m_rayCastManager.ProcessQueuedRequests(); | ||
3248 | m_rayCastManager.ProcessQueuedRequests(); | 2823 | m_rayCastManager.ProcessQueuedRequests(); |
3249 | 2824 | ||
3250 | if (CollectStats) | 2825 | if (CollectStats) |
@@ -3265,7 +2840,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3265 | 2840 | ||
3266 | foreach (PhysicsActor obj in m_collisionEventActors.Values) | 2841 | foreach (PhysicsActor obj in m_collisionEventActors.Values) |
3267 | { | 2842 | { |
3268 | // m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID); | 2843 | // m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID); |
3269 | 2844 | ||
3270 | switch ((ActorTypes)obj.PhysicsActorType) | 2845 | switch ((ActorTypes)obj.PhysicsActorType) |
3271 | { | 2846 | { |
@@ -3295,7 +2870,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3295 | tempTick = tempTick2; | 2870 | tempTick = tempTick2; |
3296 | } | 2871 | } |
3297 | 2872 | ||
3298 | d.WorldQuickStep(world, ODE_STEPSIZE); | 2873 | lock(SimulationLock) |
2874 | d.WorldQuickStep(world, ODE_STEPSIZE); | ||
3299 | 2875 | ||
3300 | if (CollectStats) | 2876 | if (CollectStats) |
3301 | m_stats[ODENativeStepFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick); | 2877 | m_stats[ODENativeStepFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick); |
@@ -3307,7 +2883,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3307 | m_log.ErrorFormat("[ODE SCENE]: {0}, {1}, {2}", e.Message, e.TargetSite, e); | 2883 | m_log.ErrorFormat("[ODE SCENE]: {0}, {1}, {2}", e.Message, e.TargetSite, e); |
3308 | } | 2884 | } |
3309 | 2885 | ||
3310 | timeLeft -= ODE_STEPSIZE; | 2886 | step_time -= ODE_STEPSIZE; |
2887 | fps += ODE_STEPSIZE; | ||
3311 | } | 2888 | } |
3312 | 2889 | ||
3313 | if (CollectStats) | 2890 | if (CollectStats) |
@@ -3403,6 +2980,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3403 | m_stats[ODETotalFrameMsStatName] += Util.EnvironmentTickCountSubtract(startFrameTick); | 2980 | m_stats[ODETotalFrameMsStatName] += Util.EnvironmentTickCountSubtract(startFrameTick); |
3404 | } | 2981 | } |
3405 | 2982 | ||
2983 | fps *= 1.0f/timeStep; | ||
3406 | return fps; | 2984 | return fps; |
3407 | } | 2985 | } |
3408 | 2986 | ||
@@ -3531,7 +3109,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3531 | // as the axis for the hinge. | 3109 | // as the axis for the hinge. |
3532 | 3110 | ||
3533 | // Therefore, we must get the joint's coordinate frame based on the | 3111 | // Therefore, we must get the joint's coordinate frame based on the |
3534 | // joint.Rotation field, which originates from the orientation of the | 3112 | // joint.Rotation field, which originates from the orientation of the |
3535 | // joint's proxy object in the scene. | 3113 | // joint's proxy object in the scene. |
3536 | 3114 | ||
3537 | // The joint's coordinate frame is defined as the transformation matrix | 3115 | // The joint's coordinate frame is defined as the transformation matrix |
@@ -3659,7 +3237,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3659 | int startTime = Util.EnvironmentTickCount(); | 3237 | int startTime = Util.EnvironmentTickCount(); |
3660 | m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", PhysicsSceneName, pOffset); | 3238 | m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", PhysicsSceneName, pOffset); |
3661 | 3239 | ||
3662 | 3240 | ||
3663 | float[] _heightmap; | 3241 | float[] _heightmap; |
3664 | 3242 | ||
3665 | // ok im lasy this are just a aliases | 3243 | // ok im lasy this are just a aliases |
@@ -3675,7 +3253,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3675 | 3253 | ||
3676 | _heightmap = new float[heightmapWidthSamples * heightmapHeightSamples]; | 3254 | _heightmap = new float[heightmapWidthSamples * heightmapHeightSamples]; |
3677 | 3255 | ||
3678 | |||
3679 | const float scale = 1.0f; | 3256 | const float scale = 1.0f; |
3680 | const float offset = 0.0f; | 3257 | const float offset = 0.0f; |
3681 | const float thickness = 10f; | 3258 | const float thickness = 10f; |
@@ -3722,6 +3299,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3722 | 3299 | ||
3723 | lock (OdeLock) | 3300 | lock (OdeLock) |
3724 | { | 3301 | { |
3302 | d.AllocateODEDataForThread(~0U); | ||
3303 | |||
3725 | IntPtr GroundGeom = IntPtr.Zero; | 3304 | IntPtr GroundGeom = IntPtr.Zero; |
3726 | if (RegionTerrain.TryGetValue(pOffset, out GroundGeom)) | 3305 | if (RegionTerrain.TryGetValue(pOffset, out GroundGeom)) |
3727 | { | 3306 | { |
@@ -3740,7 +3319,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3740 | IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); | 3319 | IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); |
3741 | d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, | 3320 | d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, |
3742 | heightmapWidth, heightmapHeight, | 3321 | heightmapWidth, heightmapHeight, |
3743 | (int)heightmapWidthSamples, (int)heightmapHeightSamples, | 3322 | (int)heightmapWidthSamples, |
3323 | (int)heightmapHeightSamples, | ||
3744 | scale, offset, thickness, wrap); | 3324 | scale, offset, thickness, wrap); |
3745 | 3325 | ||
3746 | d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); | 3326 | d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); |
@@ -3765,7 +3345,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3765 | 3345 | ||
3766 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); | 3346 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); |
3767 | d.GeomSetRotation(GroundGeom, ref R); | 3347 | d.GeomSetRotation(GroundGeom, ref R); |
3768 | d.GeomSetPosition(GroundGeom, pOffset.X + regionsizeX * 0.5f, pOffset.Y + regionsizeY * 0.5f, 0f); | 3348 | d.GeomSetPosition(GroundGeom, pOffset.X + regionsizeX * 0.5f, pOffset.Y + regionsizeY * 0.5f, 0.0f); |
3769 | IntPtr testGround = IntPtr.Zero; | 3349 | IntPtr testGround = IntPtr.Zero; |
3770 | if (RegionTerrain.TryGetValue(pOffset, out testGround)) | 3350 | if (RegionTerrain.TryGetValue(pOffset, out testGround)) |
3771 | { | 3351 | { |
@@ -3788,82 +3368,30 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3788 | return waterlevel; | 3368 | return waterlevel; |
3789 | } | 3369 | } |
3790 | 3370 | ||
3791 | public override bool SupportsCombining() | ||
3792 | { | ||
3793 | return m_suportCombine; | ||
3794 | } | ||
3795 | |||
3796 | public override void SetWaterLevel(float baseheight) | 3371 | public override void SetWaterLevel(float baseheight) |
3797 | { | 3372 | { |
3798 | waterlevel = baseheight; | 3373 | waterlevel = baseheight; |
3799 | // randomizeWater(waterlevel); | ||
3800 | } | 3374 | } |
3801 | 3375 | ||
3802 | /* | 3376 | [HandleProcessCorruptedStateExceptions] |
3803 | private void randomizeWater(float baseheight) | 3377 | public override void Dispose() |
3804 | { | 3378 | { |
3805 | uint heightmapWidth = m_regionWidth + 2; | 3379 | lock(SimulationLock) |
3806 | uint heightmapHeight = m_regionHeight + 2; | 3380 | lock(OdeLock) |
3807 | uint heightmapWidthSamples = m_regionWidth + 2; | ||
3808 | uint heightmapHeightSamples = m_regionHeight + 2; | ||
3809 | float scale = 1.0f; | ||
3810 | float offset = 0.0f; | ||
3811 | float thickness = 2.9f; | ||
3812 | int wrap = 0; | ||
3813 | |||
3814 | for (int i = 0; i < (258 * 258); i++) | ||
3815 | { | ||
3816 | _watermap[i] = (baseheight-0.1f) + ((float)fluidRandomizer.Next(1,9) / 10f); | ||
3817 | // m_log.Info((baseheight - 0.1f) + ((float)fluidRandomizer.Next(1, 9) / 10f)); | ||
3818 | } | ||
3819 | |||
3820 | lock (OdeLock) | ||
3821 | { | 3381 | { |
3822 | if (WaterGeom != IntPtr.Zero) | 3382 | if(world == IntPtr.Zero) |
3823 | { | 3383 | return; |
3824 | d.SpaceRemove(space, WaterGeom); | ||
3825 | } | ||
3826 | IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); | ||
3827 | d.GeomHeightfieldDataBuildSingle(HeightmapData, _watermap, 0, heightmapWidth, heightmapHeight, | ||
3828 | (int)heightmapWidthSamples, (int)heightmapHeightSamples, scale, | ||
3829 | offset, thickness, wrap); | ||
3830 | d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); | ||
3831 | WaterGeom = d.CreateHeightfield(space, HeightmapData, 1); | ||
3832 | if (WaterGeom != IntPtr.Zero) | ||
3833 | { | ||
3834 | d.GeomSetCategoryBits(WaterGeom, (int)(CollisionCategories.Water)); | ||
3835 | d.GeomSetCollideBits(WaterGeom, (int)(CollisionCategories.Space)); | ||
3836 | } | ||
3837 | |||
3838 | geom_name_map[WaterGeom] = "Water"; | ||
3839 | |||
3840 | d.Matrix3 R = new d.Matrix3(); | ||
3841 | |||
3842 | Quaternion q1 = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 1.5707f); | ||
3843 | Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f); | ||
3844 | //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); | ||
3845 | 3384 | ||
3846 | q1 = q1 * q2; | 3385 | _worldInitialized = false; |
3847 | //q1 = q1 * q3; | ||
3848 | Vector3 v3; | ||
3849 | float angle; | ||
3850 | q1.GetAxisAngle(out v3, out angle); | ||
3851 | 3386 | ||
3852 | d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); | 3387 | d.AllocateODEDataForThread(~0U); |
3853 | d.GeomSetRotation(WaterGeom, ref R); | ||
3854 | d.GeomSetPosition(WaterGeom, 128, 128, 0); | ||
3855 | } | ||
3856 | } | ||
3857 | */ | ||
3858 | public override void Dispose() | ||
3859 | { | ||
3860 | _worldInitialized = false; | ||
3861 | 3388 | ||
3862 | m_rayCastManager.Dispose(); | 3389 | if (m_rayCastManager != null) |
3863 | m_rayCastManager = null; | 3390 | { |
3391 | m_rayCastManager.Dispose(); | ||
3392 | m_rayCastManager = null; | ||
3393 | } | ||
3864 | 3394 | ||
3865 | lock (OdeLock) | ||
3866 | { | ||
3867 | lock (_prims) | 3395 | lock (_prims) |
3868 | { | 3396 | { |
3869 | foreach (OdePrim prm in _prims) | 3397 | foreach (OdePrim prm in _prims) |
@@ -3876,10 +3404,33 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3876 | //{ | 3404 | //{ |
3877 | //RemoveAvatar(act); | 3405 | //RemoveAvatar(act); |
3878 | //} | 3406 | //} |
3879 | d.WorldDestroy(world); | 3407 | IntPtr GroundGeom = IntPtr.Zero; |
3880 | //d.CloseODE(); | 3408 | if (RegionTerrain.TryGetValue(m_worldOffset, out GroundGeom)) |
3409 | { | ||
3410 | RegionTerrain.Remove(m_worldOffset); | ||
3411 | if (GroundGeom != IntPtr.Zero) | ||
3412 | { | ||
3413 | if (TerrainHeightFieldHeights.ContainsKey(GroundGeom)) | ||
3414 | TerrainHeightFieldHeights.Remove(GroundGeom); | ||
3415 | d.GeomDestroy(GroundGeom); | ||
3416 | } | ||
3417 | } | ||
3418 | |||
3419 | try | ||
3420 | { | ||
3421 | d.WorldDestroy(world); | ||
3422 | world = IntPtr.Zero; | ||
3423 | } | ||
3424 | catch (AccessViolationException e) | ||
3425 | { | ||
3426 | m_log.ErrorFormat("[ODE SCENE]: exception {0}", e.Message); | ||
3427 | } | ||
3881 | } | 3428 | } |
3429 | } | ||
3882 | 3430 | ||
3431 | private int compareByCollisionsDesc(OdePrim A, OdePrim B) | ||
3432 | { | ||
3433 | return -A.CollisionScore.CompareTo(B.CollisionScore); | ||
3883 | } | 3434 | } |
3884 | 3435 | ||
3885 | public override Dictionary<uint, float> GetTopColliders() | 3436 | public override Dictionary<uint, float> GetTopColliders() |
@@ -3889,7 +3440,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3889 | lock (_prims) | 3440 | lock (_prims) |
3890 | { | 3441 | { |
3891 | List<OdePrim> orderedPrims = new List<OdePrim>(_prims); | 3442 | List<OdePrim> orderedPrims = new List<OdePrim>(_prims); |
3892 | orderedPrims.OrderByDescending(p => p.CollisionScore); | 3443 | orderedPrims.Sort(compareByCollisionsDesc); |
3893 | topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); | 3444 | topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); |
3894 | 3445 | ||
3895 | foreach (OdePrim p in _prims) | 3446 | foreach (OdePrim p in _prims) |
@@ -3940,133 +3491,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3940 | return new List<ContactResult>(ourResults); | 3491 | return new List<ContactResult>(ourResults); |
3941 | } | 3492 | } |
3942 | 3493 | ||
3943 | #if USE_DRAWSTUFF | ||
3944 | // Keyboard callback | ||
3945 | public void command(int cmd) | ||
3946 | { | ||
3947 | IntPtr geom; | ||
3948 | d.Mass mass; | ||
3949 | d.Vector3 sides = new d.Vector3(d.RandReal() * 0.5f + 0.1f, d.RandReal() * 0.5f + 0.1f, d.RandReal() * 0.5f + 0.1f); | ||
3950 | |||
3951 | |||
3952 | |||
3953 | Char ch = Char.ToLower((Char)cmd); | ||
3954 | switch ((Char)ch) | ||
3955 | { | ||
3956 | case 'w': | ||
3957 | try | ||
3958 | { | ||
3959 | Vector3 rotate = (new Vector3(1, 0, 0) * Quaternion.CreateFromEulers(hpr.Z * Utils.DEG_TO_RAD, hpr.Y * Utils.DEG_TO_RAD, hpr.X * Utils.DEG_TO_RAD)); | ||
3960 | |||
3961 | xyz.X += rotate.X; xyz.Y += rotate.Y; xyz.Z += rotate.Z; | ||
3962 | ds.SetViewpoint(ref xyz, ref hpr); | ||
3963 | } | ||
3964 | catch (ArgumentException) | ||
3965 | { hpr.X = 0; } | ||
3966 | break; | ||
3967 | |||
3968 | case 'a': | ||
3969 | hpr.X++; | ||
3970 | ds.SetViewpoint(ref xyz, ref hpr); | ||
3971 | break; | ||
3972 | |||
3973 | case 's': | ||
3974 | try | ||
3975 | { | ||
3976 | Vector3 rotate2 = (new Vector3(-1, 0, 0) * Quaternion.CreateFromEulers(hpr.Z * Utils.DEG_TO_RAD, hpr.Y * Utils.DEG_TO_RAD, hpr.X * Utils.DEG_TO_RAD)); | ||
3977 | |||
3978 | xyz.X += rotate2.X; xyz.Y += rotate2.Y; xyz.Z += rotate2.Z; | ||
3979 | ds.SetViewpoint(ref xyz, ref hpr); | ||
3980 | } | ||
3981 | catch (ArgumentException) | ||
3982 | { hpr.X = 0; } | ||
3983 | break; | ||
3984 | case 'd': | ||
3985 | hpr.X--; | ||
3986 | ds.SetViewpoint(ref xyz, ref hpr); | ||
3987 | break; | ||
3988 | case 'r': | ||
3989 | xyz.Z++; | ||
3990 | ds.SetViewpoint(ref xyz, ref hpr); | ||
3991 | break; | ||
3992 | case 'f': | ||
3993 | xyz.Z--; | ||
3994 | ds.SetViewpoint(ref xyz, ref hpr); | ||
3995 | break; | ||
3996 | case 'e': | ||
3997 | xyz.Y++; | ||
3998 | ds.SetViewpoint(ref xyz, ref hpr); | ||
3999 | break; | ||
4000 | case 'q': | ||
4001 | xyz.Y--; | ||
4002 | ds.SetViewpoint(ref xyz, ref hpr); | ||
4003 | break; | ||
4004 | } | ||
4005 | } | ||
4006 | |||
4007 | public void step(int pause) | ||
4008 | { | ||
4009 | |||
4010 | ds.SetColor(1.0f, 1.0f, 0.0f); | ||
4011 | ds.SetTexture(ds.Texture.Wood); | ||
4012 | lock (_prims) | ||
4013 | { | ||
4014 | foreach (OdePrim prm in _prims) | ||
4015 | { | ||
4016 | //IntPtr body = d.GeomGetBody(prm.prim_geom); | ||
4017 | if (prm.prim_geom != IntPtr.Zero) | ||
4018 | { | ||
4019 | d.Vector3 pos; | ||
4020 | d.GeomCopyPosition(prm.prim_geom, out pos); | ||
4021 | //d.BodyCopyPosition(body, out pos); | ||
4022 | |||
4023 | d.Matrix3 R; | ||
4024 | d.GeomCopyRotation(prm.prim_geom, out R); | ||
4025 | //d.BodyCopyRotation(body, out R); | ||
4026 | |||
4027 | |||
4028 | d.Vector3 sides = new d.Vector3(); | ||
4029 | sides.X = prm.Size.X; | ||
4030 | sides.Y = prm.Size.Y; | ||
4031 | sides.Z = prm.Size.Z; | ||
4032 | |||
4033 | ds.DrawBox(ref pos, ref R, ref sides); | ||
4034 | } | ||
4035 | } | ||
4036 | } | ||
4037 | ds.SetColor(1.0f, 0.0f, 0.0f); | ||
4038 | |||
4039 | foreach (OdeCharacter chr in _characters) | ||
4040 | { | ||
4041 | if (chr.Shell != IntPtr.Zero) | ||
4042 | { | ||
4043 | IntPtr body = d.GeomGetBody(chr.Shell); | ||
4044 | |||
4045 | d.Vector3 pos; | ||
4046 | d.GeomCopyPosition(chr.Shell, out pos); | ||
4047 | //d.BodyCopyPosition(body, out pos); | ||
4048 | |||
4049 | d.Matrix3 R; | ||
4050 | d.GeomCopyRotation(chr.Shell, out R); | ||
4051 | //d.BodyCopyRotation(body, out R); | ||
4052 | |||
4053 | ds.DrawCapsule(ref pos, ref R, chr.Size.Z, 0.35f); | ||
4054 | d.Vector3 sides = new d.Vector3(); | ||
4055 | sides.X = 0.5f; | ||
4056 | sides.Y = 0.5f; | ||
4057 | sides.Z = 0.5f; | ||
4058 | |||
4059 | ds.DrawBox(ref pos, ref R, ref sides); | ||
4060 | } | ||
4061 | } | ||
4062 | } | ||
4063 | |||
4064 | public void start(int unused) | ||
4065 | { | ||
4066 | ds.SetViewpoint(ref xyz, ref hpr); | ||
4067 | } | ||
4068 | #endif | ||
4069 | |||
4070 | public override Dictionary<string, float> GetStats() | 3494 | public override Dictionary<string, float> GetStats() |
4071 | { | 3495 | { |
4072 | if (!CollectStats) | 3496 | if (!CollectStats) |
diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index 6dc22bd..2c134e7 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs | |||
@@ -47,6 +47,8 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests | |||
47 | 47 | ||
48 | //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; | 48 | //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; |
49 | private PhysicsScene pScene; | 49 | private PhysicsScene pScene; |
50 | private OpenSim.Region.PhysicsModule.ODE.OdeModule odemodule; | ||
51 | |||
50 | 52 | ||
51 | [SetUp] | 53 | [SetUp] |
52 | public void Initialize() | 54 | public void Initialize() |
@@ -65,19 +67,18 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests | |||
65 | info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize; | 67 | info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize; |
66 | OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info); | 68 | OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info); |
67 | 69 | ||
68 | //IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer(); | 70 | //IMesher mesher = new OpenSim.Region.PhysicsModule.Meshing.Meshmerizer(); |
69 | //INonSharedRegionModule mod = mesher as INonSharedRegionModule; | 71 | //INonSharedRegionModule mod = mesher as INonSharedRegionModule; |
70 | //mod.Initialise(openSimINI); | 72 | //mod.Initialise(openSimINI); |
71 | //mod.AddRegion(scene); | 73 | //mod.AddRegion(scene); |
72 | //mod.RegionLoaded(scene); | 74 | //mod.RegionLoaded(scene); |
73 | 75 | ||
74 | pScene = new OdeScene(); | 76 | // pScene = new OdeScene(); |
75 | Console.WriteLine("HERE " + (pScene == null ? "Null" : "Not null")); | 77 | odemodule = new OpenSim.Region.PhysicsModule.ODE.OdeModule(); |
76 | INonSharedRegionModule mod = (pScene as INonSharedRegionModule); | 78 | Console.WriteLine("HERE " + (odemodule == null ? "Null" : "Not null")); |
77 | Console.WriteLine("HERE " + (mod == null ? "Null" : "Not null")); | 79 | odemodule.Initialise(openSimINI); |
78 | mod.Initialise(openSimINI); | 80 | odemodule.AddRegion(scene); |
79 | mod.AddRegion(scene); | 81 | odemodule.RegionLoaded(scene); |
80 | mod.RegionLoaded(scene); | ||
81 | 82 | ||
82 | // Loading ODEPlugin | 83 | // Loading ODEPlugin |
83 | //cbt = new OdePlugin(); | 84 | //cbt = new OdePlugin(); |
@@ -90,6 +91,7 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests | |||
90 | { | 91 | { |
91 | _heightmap[i] = 21f; | 92 | _heightmap[i] = 21f; |
92 | } | 93 | } |
94 | pScene = scene.PhysicsScene; | ||
93 | pScene.SetTerrain(_heightmap); | 95 | pScene.SetTerrain(_heightmap); |
94 | } | 96 | } |
95 | 97 | ||
diff --git a/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs b/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs deleted file mode 100644 index 87ca446..0000000 --- a/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright ODE | ||
3 | * Ode.NET - .NET bindings for ODE | ||
4 | * Jason Perkins (starkos@industriousone.com) | ||
5 | * Licensed under the New BSD | ||
6 | * Part of the OpenDynamicsEngine | ||
7 | Open Dynamics Engine | ||
8 | Copyright (c) 2001-2007, Russell L. Smith. | ||
9 | All rights reserved. | ||
10 | |||
11 | Redistribution and use in source and binary forms, with or without | ||
12 | modification, are permitted provided that the following conditions | ||
13 | are met: | ||
14 | |||
15 | Redistributions of source code must retain the above copyright notice, | ||
16 | this list of conditions and the following disclaimer. | ||
17 | |||
18 | Redistributions in binary form must reproduce the above copyright notice, | ||
19 | this list of conditions and the following disclaimer in the documentation | ||
20 | and/or other materials provided with the distribution. | ||
21 | |||
22 | Neither the names of ODE's copyright owner nor the names of its | ||
23 | contributors may be used to endorse or promote products derived from | ||
24 | this software without specific prior written permission. | ||
25 | |||
26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
29 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
32 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
33 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
34 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
35 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
37 | * | ||
38 | * | ||
39 | */ | ||
40 | |||
41 | using System; | ||
42 | using System.Runtime.InteropServices; | ||
43 | using Ode.NET; | ||
44 | |||
45 | namespace Drawstuff.NET | ||
46 | { | ||
47 | #if dDOUBLE | ||
48 | using dReal = System.Double; | ||
49 | #else | ||
50 | using dReal = System.Single; | ||
51 | #endif | ||
52 | |||
53 | public static class ds | ||
54 | { | ||
55 | public const int VERSION = 2; | ||
56 | |||
57 | public enum Texture | ||
58 | { | ||
59 | None, | ||
60 | Wood | ||
61 | } | ||
62 | |||
63 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)] | ||
64 | public delegate void CallbackFunction(int arg); | ||
65 | |||
66 | [StructLayout(LayoutKind.Sequential)] | ||
67 | public struct Functions | ||
68 | { | ||
69 | public int version; | ||
70 | public CallbackFunction start; | ||
71 | public CallbackFunction step; | ||
72 | public CallbackFunction command; | ||
73 | public CallbackFunction stop; | ||
74 | public string path_to_textures; | ||
75 | } | ||
76 | |||
77 | [DllImport("drawstuff", EntryPoint = "dsDrawBox")] | ||
78 | public static extern void DrawBox(ref d.Vector3 pos, ref d.Matrix3 R, ref d.Vector3 sides); | ||
79 | |||
80 | [DllImport("drawstuff", EntryPoint = "dsDrawCapsule")] | ||
81 | public static extern void DrawCapsule(ref d.Vector3 pos, ref d.Matrix3 R, dReal length, dReal radius); | ||
82 | |||
83 | [DllImport("drawstuff", EntryPoint = "dsDrawConvex")] | ||
84 | public static extern void DrawConvex(ref d.Vector3 pos, ref d.Matrix3 R, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); | ||
85 | |||
86 | [DllImport("drawstuff", EntryPoint = "dsSetColor")] | ||
87 | public static extern void SetColor(float red, float green, float blue); | ||
88 | |||
89 | [DllImport("drawstuff", EntryPoint = "dsSetTexture")] | ||
90 | public static extern void SetTexture(Texture texture); | ||
91 | |||
92 | [DllImport("drawstuff", EntryPoint = "dsSetViewpoint")] | ||
93 | public static extern void SetViewpoint(ref d.Vector3 xyz, ref d.Vector3 hpr); | ||
94 | |||
95 | [DllImport("drawstuff", EntryPoint = "dsSimulationLoop")] | ||
96 | public static extern void SimulationLoop(int argc, string[] argv, int window_width, int window_height, ref Functions fn); | ||
97 | } | ||
98 | } | ||