animated mesh collision question

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
ClownieTheMalicious
Posts: 28
Joined: Sun Sep 17, 2006 3:59 pm
Location: iraq

animated mesh collision question

Post by ClownieTheMalicious »

alright,
when I have a mesh and i animate it to crouch, it becomes smaller in the Y axis for my game (obviously). so my question is-
1. does the collision detection system automatically handle the resizing of the collision box or ellipsoid?
2. Which class is this operation defined in if it works that way?

3.Also, where do i define if i want a mesh to use an ellipsoid for collision or box,etc.?
i didn't think that axis aligned bounding box class was for the basic engine collision detection.
4. axis aligned means it maintains it's orientation with respect to it's parent node correct?

thanks
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

1. The triangle selector code does not properly update, but the bounding box does.
2. The scene node bounding box is the only thing that does update.
3. Irrlicht only provides bounding boxes and triangle selectors for collision. If you want anything else you get to write it yourself or integrate it from another collision library.
4. No, axis aligned doesn't mean anything about which axis it is aligned to. the box could be an object space axis aligned bounding box or it could be a world space axis aligned bounding box. It just depends on how it is used. If you call getBoundingBox() on a scene node, it is supposed to be an object space bounding box.

Travis
ClownieTheMalicious
Posts: 28
Joined: Sun Sep 17, 2006 3:59 pm
Location: iraq

Post by ClownieTheMalicious »

so, in essence...

if i have my mesh crouch to go into a vent say, as long as the bounding box is updated it will work? even if the triangle selector portion doesn't update correctly? how would i force the triangle selector to update- would it be a relatively simple matter of just adding a forceUpdate function to the triangle selector code and then go through the mesh again?

also could you build upon what you meant by the triangle selector system doesn't update correctly?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

if i have my mesh crouch to go into a vent say, as long as the bounding box is updated it will work?
If you are using a collision response animator, you just need to update the radius on the animator. You don't need to worry about the triangle selectors. You only need to worry about triangle selectors if the things the camera/player will collide with are animating.
also could you build upon what you meant by the triangle selector system doesn't update correctly?
The triangle selector code creates a copy of all of the triangles used in the mesh. If the mesh vertices move, the triangle list maintained by the selector is not updated. The regular and oct tree triangle selectors are not intended to be used animated meshes, they only work with a single mesh.

There is no facility for 'updating' a triangle selector and those selectors don't know how to work with animated meshes. That said, I should clarify. The bounding box triangle selector will correctly update based on the animated mesh frame. As long as the bounding box is up to date, the selector will work.

You could force a triangle selector to update by removing it and creating a new one from scratch based on the current animation frame of the animated mesh. You could also write your own triangle selector that works with animated meshes. It wouldn't be incredibly difficult. You could copy most of the code from the CTriangleSelector class. You wouldn't want to create a copy of the triangles, you'd just want to access the triangles of the mesh directly in getTriangles().

Travis
Post Reply