Mogre+MogreNewt = buggy raycasts ?


24-04-2011 12:59:18

One month ago a Mogre user posted a bug report in the Mogre forum (related to the MogreNewt wrapper).
Until today there is no answer. So I want to ask here if there are/were similar problems for the OgreNewt wrapper.

Here is the forum post:

Here a quote:


i've been playing with newton for last few days and came up with annoying bug which i cannot solve.

I'm using NewtonWorldRayCast to check if my light is occluded and display / hide it.

I'm using the MogreNewt BasicRaycast that does this and i found that it does not find collision against ellipse collision body.

If i use mesh ( TreeCollision ) it works correctly and does find the hit.

I could not find information that world ray collision does not find convex collision bodies or something similar, also i've checked the notes on the wiki regarding worldraycast, but all those are fullfilled.

basically it's down to
col = new MogreNewt.CollisionPrimitives.Ellipsoid( world, new Vector3( 50, 40, 50 ), 667 );
col = new MogreNewt.CollisionPrimitives.TreeCollisionSceneParser( world );
the rest of code is the same in both cases.

i have version 2.25, so i tried to recompile with 2.32 but it had exactly the same issue and in 2.32 even the mesh collision became buggy ( sometimes it did not detect any collision though the ray went through the mesh ).

Then i tested with 3 versions ( 2.25, 2.27 and latest 2.32 ).

the Ellipsoid does work only if i create sphere - if at least one dimension is other then others, the collisions do not hit. Seems there is no hit body at all, as all the angles do not detect hit. Debug showed properly created sphere/ellipsoid.

the mesh problem - seems to be present in all 3 versions for objects created from ogre models through TreeCollisionParser OR ConvexHull parser of Mogre SceneNode. They occasionaly do not hit the mesh, mostly when the collision ray goes through edge between two triangles.

In both cases it could be because of Mogrenewt or the fact that mogre i have is compiled with Ogre::Real = float so there is lot of warnings about double/float conversion when i compile the MogreNewt.

Do you have any suggestion for next steps ? i can live without the Ellipsoid but the convex collision problems are bad for me.

I update in fixed interval steps ( currently 1/60s ), debug shows newton bodies properly positioned, scaled etc, raycast start,end points are correct ( go through the body ), and neither start nor end are inside the body.

I asked around in newton forums, but as expected the newton should definitely not produce those bugs, noone else had these problems so it's somewhere in mogrenewt or mogre itself.. maybe it's all because of the precision problems converting floats to double ?

Any suggestions or kicks in proper direction welcome :-)