Mogre+MogreNewt = buggy raycasts ?

rattus

15-03-2011 08:27:51

Hi,

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 );
vs
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 :-)

Beauty

24-04-2011 13:01:42

Thanks for your very detailed report and sorry for my late answer.
It's good to know, that you still asked in the Newton forum.
Unfortunately I can't help you, because I used Newton for collision detection only.

I re-published your bug report in the OgreNewt forum section. The MogreNewt wrapper is very similar. It would be interesting to know if they are/were such problems for the OgreNewt wrapper, too.
Follow the answers here:
viewtopic.php?f=4&t=14312
(Note: go to the page, scroll to the bottom and click to "suscribe topic". Then you will get a notice about answers.)

Also I added a notice about this bug/topic in the main thread of MogreNewt talk.

I whish you the best for finding out the source of the bug.

rattus

10-05-2011 14:19:05

Hi,

i gave up on that, as i was completely stuck with no idea what to check anymore.

So i abstracted my physics classes and I can switch between bullet and newton, thus I'm currently using bullet.

i still cannot see where the problem could be as all debug info showed there should be hit indeed :)

Beauty

11-05-2011 00:02:54

I suppose Bullet is a C++ library.
How did you use it by Mogre?
Maybe by this: http://code.google.com/p/bulletsharp/

I know there is a "layer" addon for physics. By use of this it's most easy to switch between underlaying physics engines. Unfortunately I don't remember the name and I couldn't find it by a quick search.
Just for notice.

rattus

11-05-2011 07:59:51

yeah i used bulletsharp, it's quite faithfull port.

for the "layer", so far i have just simple needs for physics so i just abstracted body, collision detection and some physical properties ( velocity, omega, mass etc ).
it helps that bullet and newton do most of the things quite same, just different function name :)