Making a scene node invisible but still work
Making a scene node invisible but still work
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?
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
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
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.
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)
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)
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.
I worked around it by keeping the box visible, but with a totally transparent alpha map.