Check for collision between Mesh and .bsp

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
t
Posts: 43
Joined: Sun Nov 02, 2003 2:59 am
Location: Australia

Check for collision between Mesh and .bsp

Post by t »

I've got some meshes that I would like to check for collision against my bsp level. (I want to make my mesh objects reduce their energy and maybe explode when they touch the walls inside the .bsp file).

How can I check for collision between a mesh and a wall inside the bsp file?
I read the collision tutorial but it didn't seem to have what I want.
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

You have to create a triangle selector for every object and add them to a metaTriangleSelector, look that up in the API. Then the metaTriangleSelector is the 1 attached to the camera when you call the createCollisionResponseAnimator.

but it's not working... I'm hoping Niko will have it fixed in the next release because as of right now the collision will only work with the last triangle selector that was added to the metaTriangleSelector. Try it and see if you have the same problems.
t
Posts: 43
Joined: Sun Nov 02, 2003 2:59 am
Location: Australia

Post by t »

Thanks for your response [dx/x]=HUNT3R (are you a fan of calculus? :) )

I'm a bit confused by the CollisionResponseAnimator , too. Is there a way I can set it up to run my own code. I don't only want to run an animation, but also update game variables etc when a collision occurs. As far as I can tell hte CollisionResponseAnimator just repositions or moves the mesh. Is this right?
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

t wrote:Thanks for your response [dx/x]=HUNT3R (are you a fan of calculus? :) )
Yes, I'm about to graduate from college next month and one of my degrees will be in Mathematics, the other in Computer Science of course.

As for the collisionResponseAnimator, the collision detection is automatically done by the engine so yeah I guess you can think of it as just repositioning or moving the mesh off of the other object it's colliding with. Alternatively you can use irr::scene::IAnimatedMesh::getBoundingBox() which will return a aabbox3d as the axis aligned bounding box of the mesh and write code to take care of the collisions yourself. And if you want to generate events from collisions then you're gonna have to write your own code to take care of that. Hopefully though, Niko will have the metaTriangleSelector problem fixed in the near future. Did you try it? Did you have the same results that only the last triangle selector added works?
Post Reply