Collision detection with irr file

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
HighTreason
Posts: 5
Joined: Thu Jan 31, 2008 7:37 pm

Collision detection with irr file

Post by HighTreason »

Hello.

I have another (no doubt) stupid question. I can't figure out how to do collision detection with a mesh in my .irr file. Actually, I want it to collide with everything in that file, but I imagine I have to add a CollisionResponseAnimator for each one. I don't know how to get to those meshes from my program, however. I need them to create my TriangleSelector. Anyone know how to do this?

I am writing in C#, but any example code in C++ would be just as helpful as I'm familiar with both.

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

Post by vitek »

I posted some code for doing this a while back. It shows how to iterate through each element in the scene graph and generate collision information for them. It uses the Irrlicht provided collision system, but you could easily modify it to use a physics engine for collision detection.

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=19725

I added a small optimization that prevents doing per-triangle collision testing on every node. You can find that code here.

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=21015

Please keep in mind that this code is just a sample. It works, but is less than optimal and uses a very primitive collision system.

Travis
HighTreason
Posts: 5
Joined: Thu Jan 31, 2008 7:37 pm

Post by HighTreason »

Thanks for the help. Unfortunately, I am still having some problems, but They are related to the .NET CP wrapper, so I have moved my issue over there. Thanks for getting me a little further.
Post Reply