diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs | 116 |
1 files changed, 57 insertions, 59 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs index f671722..2e3a197 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs | |||
@@ -29,10 +29,8 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Runtime.InteropServices; | 31 | using System.Runtime.InteropServices; |
32 | using System.Text; | ||
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
34 | using OpenSim.Region.PhysicsModules.SharedBase; | 33 | using OpenSim.Region.PhysicsModules.SharedBase; |
35 | using OdeAPI; | ||
36 | using log4net; | 34 | using log4net; |
37 | using OpenMetaverse; | 35 | using OpenMetaverse; |
38 | 36 | ||
@@ -67,7 +65,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
67 | /// <summary> | 65 | /// <summary> |
68 | /// ODE near callback delegate | 66 | /// ODE near callback delegate |
69 | /// </summary> | 67 | /// </summary> |
70 | private d.NearCallback nearCallback; | 68 | private SafeNativeMethods.NearCallback nearCallback; |
71 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 69 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
72 | private List<ContactResult> m_contactResults = new List<ContactResult>(); | 70 | private List<ContactResult> m_contactResults = new List<ContactResult>(); |
73 | private RayFilterFlags CurrentRayFilter; | 71 | private RayFilterFlags CurrentRayFilter; |
@@ -77,14 +75,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
77 | { | 75 | { |
78 | m_scene = pScene; | 76 | m_scene = pScene; |
79 | nearCallback = near; | 77 | nearCallback = near; |
80 | ray = d.CreateRay(IntPtr.Zero, 1.0f); | 78 | ray = SafeNativeMethods.CreateRay(IntPtr.Zero, 1.0f); |
81 | d.GeomSetCategoryBits(ray, 0); | 79 | SafeNativeMethods.GeomSetCategoryBits(ray, 0); |
82 | Box = d.CreateBox(IntPtr.Zero, 1.0f, 1.0f, 1.0f); | 80 | Box = SafeNativeMethods.CreateBox(IntPtr.Zero, 1.0f, 1.0f, 1.0f); |
83 | d.GeomSetCategoryBits(Box, 0); | 81 | SafeNativeMethods.GeomSetCategoryBits(Box, 0); |
84 | Sphere = d.CreateSphere(IntPtr.Zero,1.0f); | 82 | Sphere = SafeNativeMethods.CreateSphere(IntPtr.Zero,1.0f); |
85 | d.GeomSetCategoryBits(Sphere, 0); | 83 | SafeNativeMethods.GeomSetCategoryBits(Sphere, 0); |
86 | Plane = d.CreatePlane(IntPtr.Zero, 0f,0f,1f,1f); | 84 | Plane = SafeNativeMethods.CreatePlane(IntPtr.Zero, 0f,0f,1f,1f); |
87 | d.GeomSetCategoryBits(Sphere, 0); | 85 | SafeNativeMethods.GeomSetCategoryBits(Sphere, 0); |
88 | } | 86 | } |
89 | 87 | ||
90 | public void QueueRequest(ODERayRequest req) | 88 | public void QueueRequest(ODERayRequest req) |
@@ -152,29 +150,29 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
152 | { | 150 | { |
153 | if (CollisionContactGeomsPerTest > 80) | 151 | if (CollisionContactGeomsPerTest > 80) |
154 | CollisionContactGeomsPerTest = 80; | 152 | CollisionContactGeomsPerTest = 80; |
155 | d.GeomBoxSetLengths(Box, req.Normal.X, req.Normal.Y, req.Normal.Z); | 153 | SafeNativeMethods.GeomBoxSetLengths(Box, req.Normal.X, req.Normal.Y, req.Normal.Z); |
156 | d.GeomSetPosition(Box, req.Origin.X, req.Origin.Y, req.Origin.Z); | 154 | SafeNativeMethods.GeomSetPosition(Box, req.Origin.X, req.Origin.Y, req.Origin.Z); |
157 | d.Quaternion qtmp; | 155 | SafeNativeMethods.Quaternion qtmp; |
158 | qtmp.X = req.orientation.X; | 156 | qtmp.X = req.orientation.X; |
159 | qtmp.Y = req.orientation.Y; | 157 | qtmp.Y = req.orientation.Y; |
160 | qtmp.Z = req.orientation.Z; | 158 | qtmp.Z = req.orientation.Z; |
161 | qtmp.W = req.orientation.W; | 159 | qtmp.W = req.orientation.W; |
162 | d.GeomSetQuaternion(Box, ref qtmp); | 160 | SafeNativeMethods.GeomSetQuaternion(Box, ref qtmp); |
163 | } | 161 | } |
164 | else if (req.callbackMethod is ProbeSphereCallback) | 162 | else if (req.callbackMethod is ProbeSphereCallback) |
165 | { | 163 | { |
166 | if (CollisionContactGeomsPerTest > 80) | 164 | if (CollisionContactGeomsPerTest > 80) |
167 | CollisionContactGeomsPerTest = 80; | 165 | CollisionContactGeomsPerTest = 80; |
168 | 166 | ||
169 | d.GeomSphereSetRadius(Sphere, req.length); | 167 | SafeNativeMethods.GeomSphereSetRadius(Sphere, req.length); |
170 | d.GeomSetPosition(Sphere, req.Origin.X, req.Origin.Y, req.Origin.Z); | 168 | SafeNativeMethods.GeomSetPosition(Sphere, req.Origin.X, req.Origin.Y, req.Origin.Z); |
171 | } | 169 | } |
172 | else if (req.callbackMethod is ProbePlaneCallback) | 170 | else if (req.callbackMethod is ProbePlaneCallback) |
173 | { | 171 | { |
174 | if (CollisionContactGeomsPerTest > 80) | 172 | if (CollisionContactGeomsPerTest > 80) |
175 | CollisionContactGeomsPerTest = 80; | 173 | CollisionContactGeomsPerTest = 80; |
176 | 174 | ||
177 | d.GeomPlaneSetParams(Plane, req.Normal.X, req.Normal.Y, req.Normal.Z, req.length); | 175 | SafeNativeMethods.GeomPlaneSetParams(Plane, req.Normal.X, req.Normal.Y, req.Normal.Z, req.length); |
178 | } | 176 | } |
179 | 177 | ||
180 | else | 178 | else |
@@ -182,24 +180,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
182 | if (CollisionContactGeomsPerTest > 25) | 180 | if (CollisionContactGeomsPerTest > 25) |
183 | CollisionContactGeomsPerTest = 25; | 181 | CollisionContactGeomsPerTest = 25; |
184 | 182 | ||
185 | d.GeomRaySetLength(ray, req.length); | 183 | SafeNativeMethods.GeomRaySetLength(ray, req.length); |
186 | d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); | 184 | SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); |
187 | d.GeomRaySetParams(ray, 0, backfacecull); | 185 | SafeNativeMethods.GeomRaySetParams(ray, 0, backfacecull); |
188 | 186 | ||
189 | if (req.callbackMethod is RaycastCallback) | 187 | if (req.callbackMethod is RaycastCallback) |
190 | { | 188 | { |
191 | // if we only want one get only one per Collision pair saving memory | 189 | // if we only want one get only one per Collision pair saving memory |
192 | CurrentRayFilter |= RayFilterFlags.ClosestHit; | 190 | CurrentRayFilter |= RayFilterFlags.ClosestHit; |
193 | d.GeomRaySetClosestHit(ray, 1); | 191 | SafeNativeMethods.GeomRaySetClosestHit(ray, 1); |
194 | } | 192 | } |
195 | else | 193 | else |
196 | d.GeomRaySetClosestHit(ray, closestHit); | 194 | SafeNativeMethods.GeomRaySetClosestHit(ray, closestHit); |
197 | } | 195 | } |
198 | 196 | ||
199 | if ((CurrentRayFilter & RayFilterFlags.ContactsUnImportant) != 0) | 197 | if ((CurrentRayFilter & RayFilterFlags.ContactsUnImportant) != 0) |
200 | unchecked | 198 | unchecked |
201 | { | 199 | { |
202 | CollisionContactGeomsPerTest |= (int)d.CONTACTS_UNIMPORTANT; | 200 | CollisionContactGeomsPerTest |= (int)SafeNativeMethods.CONTACTS_UNIMPORTANT; |
203 | } | 201 | } |
204 | 202 | ||
205 | if (geom == IntPtr.Zero) | 203 | if (geom == IntPtr.Zero) |
@@ -224,27 +222,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
224 | if (req.callbackMethod is ProbeBoxCallback) | 222 | if (req.callbackMethod is ProbeBoxCallback) |
225 | { | 223 | { |
226 | catflags |= CollisionCategories.Space; | 224 | catflags |= CollisionCategories.Space; |
227 | d.GeomSetCollideBits(Box, (uint)catflags); | 225 | SafeNativeMethods.GeomSetCollideBits(Box, (uint)catflags); |
228 | d.GeomSetCategoryBits(Box, (uint)catflags); | 226 | SafeNativeMethods.GeomSetCategoryBits(Box, (uint)catflags); |
229 | doProbe(req, Box); | 227 | doProbe(req, Box); |
230 | } | 228 | } |
231 | else if (req.callbackMethod is ProbeSphereCallback) | 229 | else if (req.callbackMethod is ProbeSphereCallback) |
232 | { | 230 | { |
233 | catflags |= CollisionCategories.Space; | 231 | catflags |= CollisionCategories.Space; |
234 | d.GeomSetCollideBits(Sphere, (uint)catflags); | 232 | SafeNativeMethods.GeomSetCollideBits(Sphere, (uint)catflags); |
235 | d.GeomSetCategoryBits(Sphere, (uint)catflags); | 233 | SafeNativeMethods.GeomSetCategoryBits(Sphere, (uint)catflags); |
236 | doProbe(req, Sphere); | 234 | doProbe(req, Sphere); |
237 | } | 235 | } |
238 | else if (req.callbackMethod is ProbePlaneCallback) | 236 | else if (req.callbackMethod is ProbePlaneCallback) |
239 | { | 237 | { |
240 | catflags |= CollisionCategories.Space; | 238 | catflags |= CollisionCategories.Space; |
241 | d.GeomSetCollideBits(Plane, (uint)catflags); | 239 | SafeNativeMethods.GeomSetCollideBits(Plane, (uint)catflags); |
242 | d.GeomSetCategoryBits(Plane, (uint)catflags); | 240 | SafeNativeMethods.GeomSetCategoryBits(Plane, (uint)catflags); |
243 | doPlane(req,IntPtr.Zero); | 241 | doPlane(req,IntPtr.Zero); |
244 | } | 242 | } |
245 | else | 243 | else |
246 | { | 244 | { |
247 | d.GeomSetCollideBits(ray, (uint)catflags); | 245 | SafeNativeMethods.GeomSetCollideBits(ray, (uint)catflags); |
248 | doSpaceRay(req); | 246 | doSpaceRay(req); |
249 | } | 247 | } |
250 | } | 248 | } |
@@ -255,12 +253,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
255 | 253 | ||
256 | if (req.callbackMethod is ProbePlaneCallback) | 254 | if (req.callbackMethod is ProbePlaneCallback) |
257 | { | 255 | { |
258 | d.GeomSetCollideBits(Plane, (uint)CollisionCategories.All); | 256 | SafeNativeMethods.GeomSetCollideBits(Plane, (uint)CollisionCategories.All); |
259 | doPlane(req,geom); | 257 | doPlane(req,geom); |
260 | } | 258 | } |
261 | else | 259 | else |
262 | { | 260 | { |
263 | d.GeomSetCollideBits(ray, (uint)CollisionCategories.All); | 261 | SafeNativeMethods.GeomSetCollideBits(ray, (uint)CollisionCategories.All); |
264 | doGeomRay(req,geom); | 262 | doGeomRay(req,geom); |
265 | } | 263 | } |
266 | } | 264 | } |
@@ -307,11 +305,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
307 | // Collide tests | 305 | // Collide tests |
308 | if ((CurrentRayFilter & FilterActiveSpace) != 0) | 306 | if ((CurrentRayFilter & FilterActiveSpace) != 0) |
309 | { | 307 | { |
310 | d.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); | 308 | SafeNativeMethods.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); |
311 | d.SpaceCollide2(ray, m_scene.CharsSpace, IntPtr.Zero, nearCallback); | 309 | SafeNativeMethods.SpaceCollide2(ray, m_scene.CharsSpace, IntPtr.Zero, nearCallback); |
312 | } | 310 | } |
313 | if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) | 311 | if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) |
314 | d.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback); | 312 | SafeNativeMethods.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback); |
315 | if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) | 313 | if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) |
316 | { | 314 | { |
317 | // current ode land to ray collisions is very bad | 315 | // current ode land to ray collisions is very bad |
@@ -324,11 +322,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
324 | { | 322 | { |
325 | float tmp2 = req.length * req.length - tmp + 2500; | 323 | float tmp2 = req.length * req.length - tmp + 2500; |
326 | tmp2 = (float)Math.Sqrt(tmp2); | 324 | tmp2 = (float)Math.Sqrt(tmp2); |
327 | d.GeomRaySetLength(ray, tmp2); | 325 | SafeNativeMethods.GeomRaySetLength(ray, tmp2); |
328 | } | 326 | } |
329 | 327 | ||
330 | } | 328 | } |
331 | d.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback); | 329 | SafeNativeMethods.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback); |
332 | } | 330 | } |
333 | 331 | ||
334 | if (req.callbackMethod is RaycastCallback) | 332 | if (req.callbackMethod is RaycastCallback) |
@@ -377,13 +375,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
377 | // Collide tests | 375 | // Collide tests |
378 | if ((CurrentRayFilter & FilterActiveSpace) != 0) | 376 | if ((CurrentRayFilter & FilterActiveSpace) != 0) |
379 | { | 377 | { |
380 | d.SpaceCollide2(probe, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); | 378 | SafeNativeMethods.SpaceCollide2(probe, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); |
381 | d.SpaceCollide2(probe, m_scene.CharsSpace, IntPtr.Zero, nearCallback); | 379 | SafeNativeMethods.SpaceCollide2(probe, m_scene.CharsSpace, IntPtr.Zero, nearCallback); |
382 | } | 380 | } |
383 | if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) | 381 | if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) |
384 | d.SpaceCollide2(probe, m_scene.StaticSpace, IntPtr.Zero, nearCallback); | 382 | SafeNativeMethods.SpaceCollide2(probe, m_scene.StaticSpace, IntPtr.Zero, nearCallback); |
385 | if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) | 383 | if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) |
386 | d.SpaceCollide2(probe, m_scene.GroundSpace, IntPtr.Zero, nearCallback); | 384 | SafeNativeMethods.SpaceCollide2(probe, m_scene.GroundSpace, IntPtr.Zero, nearCallback); |
387 | 385 | ||
388 | List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count); | 386 | List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count); |
389 | lock (m_PendingRequests) | 387 | lock (m_PendingRequests) |
@@ -404,17 +402,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
404 | { | 402 | { |
405 | if ((CurrentRayFilter & FilterActiveSpace) != 0) | 403 | if ((CurrentRayFilter & FilterActiveSpace) != 0) |
406 | { | 404 | { |
407 | d.SpaceCollide2(Plane, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); | 405 | SafeNativeMethods.SpaceCollide2(Plane, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); |
408 | d.SpaceCollide2(Plane, m_scene.CharsSpace, IntPtr.Zero, nearCallback); | 406 | SafeNativeMethods.SpaceCollide2(Plane, m_scene.CharsSpace, IntPtr.Zero, nearCallback); |
409 | } | 407 | } |
410 | if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) | 408 | if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) |
411 | d.SpaceCollide2(Plane, m_scene.StaticSpace, IntPtr.Zero, nearCallback); | 409 | SafeNativeMethods.SpaceCollide2(Plane, m_scene.StaticSpace, IntPtr.Zero, nearCallback); |
412 | if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) | 410 | if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) |
413 | d.SpaceCollide2(Plane, m_scene.GroundSpace, IntPtr.Zero, nearCallback); | 411 | SafeNativeMethods.SpaceCollide2(Plane, m_scene.GroundSpace, IntPtr.Zero, nearCallback); |
414 | } | 412 | } |
415 | else | 413 | else |
416 | { | 414 | { |
417 | d.SpaceCollide2(Plane, geom, IntPtr.Zero, nearCallback); | 415 | SafeNativeMethods.SpaceCollide2(Plane, geom, IntPtr.Zero, nearCallback); |
418 | } | 416 | } |
419 | 417 | ||
420 | List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count); | 418 | List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count); |
@@ -434,7 +432,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
434 | private void doGeomRay(ODERayRequest req, IntPtr geom) | 432 | private void doGeomRay(ODERayRequest req, IntPtr geom) |
435 | { | 433 | { |
436 | // Collide test | 434 | // Collide test |
437 | d.SpaceCollide2(ray, geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test | 435 | SafeNativeMethods.SpaceCollide2(ray, geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test |
438 | 436 | ||
439 | if (req.callbackMethod is RaycastCallback) | 437 | if (req.callbackMethod is RaycastCallback) |
440 | { | 438 | { |
@@ -478,14 +476,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
478 | } | 476 | } |
479 | } | 477 | } |
480 | 478 | ||
481 | private bool GetCurContactGeom(int index, ref d.ContactGeom newcontactgeom) | 479 | private bool GetCurContactGeom(int index, ref SafeNativeMethods.ContactGeom newcontactgeom) |
482 | { | 480 | { |
483 | IntPtr ContactgeomsArray = m_scene.ContactgeomsArray; | 481 | IntPtr ContactgeomsArray = m_scene.ContactgeomsArray; |
484 | if (ContactgeomsArray == IntPtr.Zero || index >= CollisionContactGeomsPerTest) | 482 | if (ContactgeomsArray == IntPtr.Zero || index >= CollisionContactGeomsPerTest) |
485 | return false; | 483 | return false; |
486 | 484 | ||
487 | IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * d.ContactGeom.unmanagedSizeOf)); | 485 | IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * SafeNativeMethods.ContactGeom.unmanagedSizeOf)); |
488 | newcontactgeom = (d.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(d.ContactGeom)); | 486 | newcontactgeom = (SafeNativeMethods.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(SafeNativeMethods.ContactGeom)); |
489 | return true; | 487 | return true; |
490 | } | 488 | } |
491 | 489 | ||
@@ -498,11 +496,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
498 | if (m_contactResults.Count >= CurrentMaxCount) | 496 | if (m_contactResults.Count >= CurrentMaxCount) |
499 | return; | 497 | return; |
500 | 498 | ||
501 | if (d.GeomIsSpace(g2)) | 499 | if (SafeNativeMethods.GeomIsSpace(g2)) |
502 | { | 500 | { |
503 | try | 501 | try |
504 | { | 502 | { |
505 | d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); | 503 | SafeNativeMethods.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); |
506 | } | 504 | } |
507 | catch (Exception e) | 505 | catch (Exception e) |
508 | { | 506 | { |
@@ -514,7 +512,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
514 | int count = 0; | 512 | int count = 0; |
515 | try | 513 | try |
516 | { | 514 | { |
517 | count = d.CollidePtr(g1, g2, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); | 515 | count = SafeNativeMethods.CollidePtr(g1, g2, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf); |
518 | } | 516 | } |
519 | catch (Exception e) | 517 | catch (Exception e) |
520 | { | 518 | { |
@@ -586,7 +584,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
586 | break; | 584 | break; |
587 | } | 585 | } |
588 | 586 | ||
589 | d.ContactGeom curcontact = new d.ContactGeom(); | 587 | SafeNativeMethods.ContactGeom curcontact = new SafeNativeMethods.ContactGeom(); |
590 | 588 | ||
591 | // closestHit for now only works for meshs, so must do it for others | 589 | // closestHit for now only works for meshs, so must do it for others |
592 | if ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0) | 590 | if ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0) |
@@ -654,22 +652,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
654 | m_scene = null; | 652 | m_scene = null; |
655 | if (ray != IntPtr.Zero) | 653 | if (ray != IntPtr.Zero) |
656 | { | 654 | { |
657 | d.GeomDestroy(ray); | 655 | SafeNativeMethods.GeomDestroy(ray); |
658 | ray = IntPtr.Zero; | 656 | ray = IntPtr.Zero; |
659 | } | 657 | } |
660 | if (Box != IntPtr.Zero) | 658 | if (Box != IntPtr.Zero) |
661 | { | 659 | { |
662 | d.GeomDestroy(Box); | 660 | SafeNativeMethods.GeomDestroy(Box); |
663 | Box = IntPtr.Zero; | 661 | Box = IntPtr.Zero; |
664 | } | 662 | } |
665 | if (Sphere != IntPtr.Zero) | 663 | if (Sphere != IntPtr.Zero) |
666 | { | 664 | { |
667 | d.GeomDestroy(Sphere); | 665 | SafeNativeMethods.GeomDestroy(Sphere); |
668 | Sphere = IntPtr.Zero; | 666 | Sphere = IntPtr.Zero; |
669 | } | 667 | } |
670 | if (Plane != IntPtr.Zero) | 668 | if (Plane != IntPtr.Zero) |
671 | { | 669 | { |
672 | d.GeomDestroy(Plane); | 670 | SafeNativeMethods.GeomDestroy(Plane); |
673 | Plane = IntPtr.Zero; | 671 | Plane = IntPtr.Zero; |
674 | } | 672 | } |
675 | } | 673 | } |