Collsion Manger

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
nannolo
Posts: 27
Joined: Thu Mar 20, 2008 7:56 pm
Location: Burning Hell

Collsion Manger

Post by nannolo »

Hi I need to create events in the game,
like if i get near a door , i need to show some message in some case
maybe something like "Door locked"

and i was thinking how to do that.

I thought about creating a inviseble object and when my
charcter collide this invisible object something happen

but how can Icheck if i collide the invisible object?

is there anyone that has been already made a action rpg game ?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Re: Collsion Manger

Post by rogerborg »

nannolo wrote:I thought about creating a inviseble object and when my charcter collide this invisible object something happen
That sounds reasonable.
nannolo wrote:but how can Icheck if i collide the invisible object?
Oh so many ways. ISceneNode::getTransformedBoundingBox() will introduce you to your new best friend, aabbox3df. I suggest you spend some quality time together.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
piiichan
Posts: 59
Joined: Thu May 01, 2008 1:20 am
Location: New Caledonia (France - Pacific)
Contact:

Post by piiichan »

What you can also do is:

First, give a radius to your main character or to your camera or to whatever gets close to the door.

Then, place an invisible object where the door is.

Finally, each time the player moves, check the distance to the invisible object. If the distance is smaller than the player radius, call the method that will display your text "Door locked".

This is a basic technique for triggering event such as playing sounds, showing text or moving objects, based on the position of the player.

Be sure to somehow find a way not to test the distance from the player to all event triggers in the world, but only to those that the player is likely to get close to.
Rytz
Posts: 249
Joined: Wed Oct 25, 2006 6:05 am
Location: IL, USA
Contact:

Post by Rytz »

These are great suggestions but the real question is how to identify meshbuffers (sub-meshes) to test for these collisions? This is assuming you are trying to use standard meshes that aren't "scenes" like scenes made from irrEdit.

I had to add my own code to the engine to do it for DirectX meshes so that I could identify specific meshbuffers by name. What would you all suggest?

Some threads of interest:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=28990
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=28912
Image
nannolo
Posts: 27
Joined: Thu Mar 20, 2008 7:56 pm
Location: Burning Hell

Re: Collsion Manger

Post by nannolo »

rogerborg wrote: I suggest you spend some quality time together.
:D
Post Reply