Making a scene node invisible but still work

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
AusZero
Posts: 11
Joined: Sat Oct 06, 2007 11:16 pm

Making a scene node invisible but still work

Post by AusZero »

I'm making a game that is kind of like a platforming game. For collision detection I use flattened cube scene nodes on the top, bottom, back and front of the player, and I use the bounding boxes of each one to test for collisions. My problem is that I can't make the cube scene nodes invisible without making them not work. Is there any way to make them invisible and still work?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

You're using the scene collision manager for this? And you have four boxes around the player to keep them inside an area?

It seems to me that it would be simpler to just use a bounding box and force the player to stay inside that box. Of course you can't use the collision manager for this, but the code is almost trivial.

Travis
AusZero
Posts: 11
Joined: Sat Oct 06, 2007 11:16 pm

Post by AusZero »

I'm using the intersectsWithBox() function, and I have four boxes to keep the player from going through things.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Yeah, I don't know why you need to use cube scene nodes and make them invisible for collision. You just need one bounding box, you don't need a scene node. That bounding box will enclose the area that the user is allowed to go. If the character/camera tries to go outside the box, you adjust the position so that it is back inside the box.
porcus
Posts: 149
Joined: Sun May 27, 2007 6:24 pm
Location: Germany

Post by porcus »

node->setVisible(0); //makes the node invisible
node->setVisible(1); //makes the node visible

and it's also important that you use absolute bounding box coordinates
when u are using intersection with boxes, because if you have relative
it won't work (you can calculate them by doing sth. like that:
absoluteminimumumedge=minimumedge+nodeposition
absolutemaximumumedge=maximumumedge+nodeposition)
fennec
Posts: 55
Joined: Fri Oct 10, 2008 7:23 am

Post by fennec »

In my experience, setting a cubescenenode to be setVisible(0) also eliminates it from collision tests (perhaps because it's geometry is generated by the program?). I ran into the problem when trying a line collision test with an invisible cubescenenode.

I worked around it by keeping the box visible, but with a totally transparent alpha map.
gogo
Posts: 65
Joined: Tue Apr 15, 2008 1:04 am

Post by gogo »

It is enough to use addEmptySceneNode for that purpose.
:?
Post Reply