collision reaction via aabbox ?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
muckelzwerg
Posts: 16
Joined: Wed May 04, 2005 11:38 am

collision reaction via aabbox ?

Post by muckelzwerg »

Hi there,

I'm trying to manage the results of a collision between objects,
which do not simple "block" each other.
All my "blockable" objects are managed via triangleselectors,
and collisionresponsanimators to prevent them from intersecting etc.
But I got additionaly objects which are allowed to intersect,
because thats needed to apply effects on the objects.
(f.e. "moving player through flames". Objects should not block each other
but I need to know if they collide)

To get this working I thought about using the aabbox.
- create aabbox around every object that can apply "effects"
- check for intersections
- work out resulting effects with the owner of the boxes

So far so nice, but there is sth. that bugs me.
AAbboxes are (as the name implies) unable to be rotated.
So if the body of the object can't be easily wrapped in a axisaligned box
wont there be a big loss of "precision" ?
And if, then how should it be dealt with ?

Is there some other "box object" that can be used in intersection testing,
which allows roation ?

Or is it just irrelevant since most objects will match the body of a rotated
box as good or as bad as they match aaboxes ?
So should inreasing the precision be handled by using more aaboxes
to get a better wraper for the objects body,
and if, is there some recommended/simple/beginners way to do
that ?

Or maybe ... is this the wrong way to work out effects from intersecting/touching objects ?
Should I try sth else, like picking via lines from the object nodes ?
SARIN
Posts: 139
Joined: Fri Oct 29, 2004 3:53 am

Post by SARIN »

template<class T>
bool irr::core::aabbox3d< T >::intersectsWithBox ( const aabbox3d< T > & other ) const [inline]

Determinates if the box intersects with an other box.

Parameters:
other: Other box to check a intersection with.

Returns:
Returns true if there is a intersection with the other box, otherwise false.
assign an aabbox3d to each node, the player and the flames. make sure u update the position though, with aabbox3d->reset(playerpos-radius,playerpos+radius); every frame loop. in fact, u might just wanna make a new one every frame, and just initialize it to the players position.
then, use aabbox3d->intersectsWithBox(playerbox);
muckelzwerg
Posts: 16
Joined: Wed May 04, 2005 11:38 am

Post by muckelzwerg »

Yep, thats what I'm doing.
Atm I'm getting the transformed bbox everytime i need it,
instead of updating; works fine.
But the problem is that I'm additionally using the "usual" irrlicht collision
detection, to prevent objects from intersecting,
which results in the effect that objects which block each other,
won't have intersections with their BBoxes.
So how do I cleanly combine those two techniques ?

Deactivating the collisions - then check the boxes - reactivate collisions ?
- doesnt't look good to me, since it would be possible for Objects to
intersect to deep, so the collision det. would do some unwanted things.
(like pushing one object through another)

Setting the ellipsoid for col.det. completely enclosed by the bbox ?
So that intersection will occur before collision happens ?
- Sounds better,but "How do I do that ?"
Seems like I still don't completely understand how to set up the ellipsoid
for col.det.
Can somebody give me a hand ?
Also, is there a way to make the ellipsoid visible, like it is possible
with the bboxes ?

thx
Post Reply