Something wrong with TreeCollision

redhead

10-08-2009 11:34:41

Hi,
I'm about to implement AI to our game engine, I'm trying to create polygon soup mentioned in this thread:
https://www.ogre3d.org/forums/viewtopic.php?f=11&t=42747&sid=3586d89d94d9408cc7abbd8b3b1b299c&start=25

What I am doing is I create Tree-Collision bodies from static objects in the scene and than I just check if some place is walkable. The check is done by standard (M)ogreNewt collision using ContactCallback. Seems to work good until some irregularities come up. Sometimes it ignores a collision (meaning ContactCallback is not called, but there is an obvious contact that can be seen). (using newton 1.5x)

Pictures will tell more. I have created very simple room, just to make sure the problem is not caused by my level mesh. By it does it anyway:

[attachment=1]room1.png[/attachment]

[attachment=0]room2.png[/attachment]

In my level scene I mention, it sometimes goes through the wall,
in this scene collision fails on the cylinder at the bottom, but just in some places as you can see - it makes a collision cube somewhere, somewhere not

And the other is a box at the top left corner (box is extruded from the sidewall, few units above the floor) and again it is partial, collision cubes are made inside the box and on its side there are not.

Just to provide more info: using Mogre and MogreNewt (Newton v1.5x), treecollision is not optimised (passing false to the TreeCollision constructors last param). I even tried to play with polygon count, I made small complex obstacles with 200 polys, and even then it came through. While playing collision with player (ellipsoid) is OK.

Does anyone know what causes this??

Thanks for any help

redhead

14-08-2009 11:50:52

Anyone? Please

I am very close to finishing implementation of AI, it already works, just to resolve this particular and most annoying problem.

deadvirus

16-08-2009 17:42:55

Is the treecollision created correctly? I mean, did you check if it is "collide-able"? I have some troubles with some treecollisions...

redhead

16-08-2009 20:59:52

What do you mean precisely by creating it correctly?

As you can see on the second image in my first post, it is collide-able because it doesnt create the boxes (for example in place of the sphere in the middle must have been collided - no created boxes).

But in some places the collision fails (just to let you know, the whole model of the room, respectively the tree-collision is done from one mesh, the wall, sphere, boxes and cylinder is all one mesh.

redhead

04-09-2009 17:34:43

please please please

kallaspriit

07-09-2009 09:39:18

So are you basically placing a box in every possible coordinate and checking whether it creates contacts? If so, I guess this might fail in some cases if the penetration is big - the collision system is not meant for this kind of usage. Maybe you should try using raycasting - for example cast just two rays between the diagonals of the cube, that should detect most cases or use more rays to be 100% sure. I would guess raycasting to be faster too.