diff options
author | UbitUmarov | 2012-10-09 00:18:39 +0100 |
---|---|---|
committer | UbitUmarov | 2012-10-09 00:18:39 +0100 |
commit | 3bf7201fd4d3e2b240f8139c20f88c916d338c31 (patch) | |
tree | f58ae6354071c182e487a72d9e5afad58c98d8a6 /OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs | |
parent | a few changes/fix (?) (diff) | |
download | opensim-SC-3bf7201fd4d3e2b240f8139c20f88c916d338c31.zip opensim-SC-3bf7201fd4d3e2b240f8139c20f88c916d338c31.tar.gz opensim-SC-3bf7201fd4d3e2b240f8139c20f88c916d338c31.tar.bz2 opensim-SC-3bf7201fd4d3e2b240f8139c20f88c916d338c31.tar.xz |
move terrain geom to own ode space. Limit range on raycast if includes
terrain until ode doesn't eat all stack. Add a pre-simulation method to do
pending actors changes (except mesh assets still not ready to use), to be
optionaly called before firing heartbeat. [UNTESTED]
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs index 21fe9c0..06cb302 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODERayCastRequestManager.cs | |||
@@ -129,7 +129,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
129 | req.length = length; | 129 | req.length = length; |
130 | req.Normal = direction; | 130 | req.Normal = direction; |
131 | req.Origin = position; | 131 | req.Origin = position; |
132 | req.filter = RayFilterFlags.AllPrims; | 132 | req.filter = RayFilterFlags.AllPrims | RayFilterFlags.land; |
133 | 133 | ||
134 | m_PendingRequests.Enqueue(req); | 134 | m_PendingRequests.Enqueue(req); |
135 | } | 135 | } |
@@ -261,6 +261,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
261 | closestHit = ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0 ? 0 : 1); | 261 | closestHit = ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0 ? 0 : 1); |
262 | backfacecull = ((CurrentRayFilter & RayFilterFlags.BackFaceCull) == 0 ? 0 : 1); | 262 | backfacecull = ((CurrentRayFilter & RayFilterFlags.BackFaceCull) == 0 ? 0 : 1); |
263 | 263 | ||
264 | // current ode land to ray collisions is very bad | ||
265 | // so for now limit its range badly | ||
266 | |||
267 | if (req.length > 30.0f && (CurrentRayFilter & RayFilterFlags.land) != 0) | ||
268 | req.length = 30.0f; | ||
269 | |||
264 | d.GeomRaySetLength(ray, req.length); | 270 | d.GeomRaySetLength(ray, req.length); |
265 | d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); | 271 | d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); |
266 | d.GeomRaySetParams(ray, 0, backfacecull); | 272 | d.GeomRaySetParams(ray, 0, backfacecull); |
@@ -288,7 +294,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
288 | catflags |= CollisionCategories.Water; | 294 | catflags |= CollisionCategories.Water; |
289 | 295 | ||
290 | if (catflags != 0) | 296 | if (catflags != 0) |
297 | { | ||
298 | d.GeomSetCollideBits(ray, (uint)catflags); | ||
291 | doSpaceRay(req); | 299 | doSpaceRay(req); |
300 | } | ||
292 | } | 301 | } |
293 | else | 302 | else |
294 | { | 303 | { |
@@ -314,7 +323,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
314 | /// | 323 | /// |
315 | 324 | ||
316 | private const RayFilterFlags FilterActiveSpace = RayFilterFlags.agent | RayFilterFlags.physical | RayFilterFlags.LSLPhanton; | 325 | private const RayFilterFlags FilterActiveSpace = RayFilterFlags.agent | RayFilterFlags.physical | RayFilterFlags.LSLPhanton; |
317 | private const RayFilterFlags FilterStaticSpace = RayFilterFlags.water | RayFilterFlags.land | RayFilterFlags.nonphysical | RayFilterFlags.LSLPhanton; | 326 | // private const RayFilterFlags FilterStaticSpace = RayFilterFlags.water | RayFilterFlags.land | RayFilterFlags.nonphysical | RayFilterFlags.LSLPhanton; |
327 | private const RayFilterFlags FilterStaticSpace = RayFilterFlags.water | RayFilterFlags.nonphysical | RayFilterFlags.LSLPhanton; | ||
318 | 328 | ||
319 | private void doSpaceRay(ODERayRequest req) | 329 | private void doSpaceRay(ODERayRequest req) |
320 | { | 330 | { |
@@ -323,6 +333,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
323 | d.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); | 333 | d.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); |
324 | if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) | 334 | if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) |
325 | d.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback); | 335 | d.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback); |
336 | if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) | ||
337 | d.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback); | ||
326 | 338 | ||
327 | if (req.callbackMethod is RaycastCallback) | 339 | if (req.callbackMethod is RaycastCallback) |
328 | { | 340 | { |