How to chech if it collides?

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
Phons
Posts: 7
Joined: Sun Nov 08, 2009 11:40 am
Location: Finland

How to chech if it collides?

Post by Phons »

So, as topic name asks, how to check if a node collides with another node.
I'm doing a shooting "game", not actually a game yet, BTW i've got a node, which is map, then i have the bullet node. Yes, the collision works fien, no problem with that, but how i check if the bullet hits the map, for deleting the bullet.
I have done the collision like this:

Code: Select all

scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
                    selector, node, core::vector3df(3,5,3),
                    core::vector3df(0,-2,0), core::vector3df(0,0,0));
	selector->drop(); // As soon as we're done with the selector, drop it.
    node->addAnimator(anim);
    anim->drop();
Edit: I have read the tutorials and search from forums but i didn't find any functions. Well, i found something but it's not working with IAnimatedMeshScenenNodes..
I just get my bullet system work.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: How to chech if it collides?

Post by randomMesh »

"Whoops..."
Phons
Posts: 7
Joined: Sun Nov 08, 2009 11:40 am
Location: Finland

Re: How to chech if it collides?

Post by Phons »

And how should i use this... not working with my selector... And does this only tell thta SOMETHING hitted wall, cause i want to know what hitted, i just can't delete randomly a bullet if something hit the wall, i need to know if a bullet hits the wall and then destory the same bullet, i don't know how that works, so...

Edit: Oh, yes sorry, my selector is a triangle selector.
I just get my bullet system work.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: How to chech if it collides?

Post by randomMesh »

Phons wrote:And does this only tell thta SOMETHING hitted wall, cause i want to know what hitted...
There's also a getCollisionNode() method, you should have read the page i linked to.
"Whoops..."
Phons
Posts: 7
Joined: Sun Nov 08, 2009 11:40 am
Location: Finland

Re: How to chech if it collides?

Post by Phons »

randomMesh wrote:There's also a getCollisionNode() method, you should have read the page i linked to.
I know that and it's not working.. It's a member of ISceneNode, and i'm using IAnimatedMeshSceneNode. There is a difference...
I just get my bullet system work.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: How to chech if it collides?

Post by randomMesh »

Phons wrote:Is a member of ISceneNode, and i'm using IAnimatedMeshSceneNode. There is a difference...
Not really in that case. An IAnimatedMeshSceneNode IS an ISceneNode.
"Whoops..."
Phons
Posts: 7
Joined: Sun Nov 08, 2009 11:40 am
Location: Finland

Post by Phons »

Oh... well it throws an error: error C2039: 'getCollisionNode' : is not a member of 'irr::scene::IAnimatedMeshSceneNode'

Edit: oh....
Last edited by Phons on Tue Nov 17, 2009 5:06 pm, edited 1 time in total.
I just get my bullet system work.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

Phons wrote:'getCollisionNode' : is not a member of 'irr::scene::IAnimatedMeshSceneNode'
True. It's a member of ISceneNodeAnimatorCollisionResponse.
"Whoops..."
Phons
Posts: 7
Joined: Sun Nov 08, 2009 11:40 am
Location: Finland

Post by Phons »

I can't find these functions from my irrlicht... Are they 1.6 things?

I checked ISceneNodeAnimatorCollisionResponse file but there is no, getCollisionNode...

Edit: No!!! This is not true!! They are 1.6 functions... God damn it!
Edit2: Sorry for these i was using 1.5 and i didn't want to chance, cause i guessed there could be problems...
I just get my bullet system work.
Post Reply