Hello everyone,
Been a long time. In fact, there was a time that I probably could have answered this question myself. But that time is no more.
Silliness aside: I’m working on a little project to prevent my once-elite BGE skills from becoming completely atrophied, and I’m in a bit of a quandary. I’m trying to make a node-based navigation system (Python-based) whereby you can jump from one node to another, a la Myst. I’m using a ray to detect nodes (cubes) which one can jump to (basically, click on a node to go there). The cubes have a “node” property for the ray to detect, and traveling to the node means ending up inside the node cube. But of course, from inside a node the ray only detects the node it’s already in. Short of some silly hack (like moving the active node cube underground or something), is there any way I can tell the ray to ignore a given object, even if it has the property? I’m open to alternative approaches, too.
Cheers!
Try the ‘x-ray’ button on the ray sensor, or enabling ‘x-ray=true’ in the raycast line.
Alternately, you could simply start the ray further away than at the player, or perhaps from the node instead.
In the node physics, check Collision Bounds : Box.
If the node is a cube, it should work.
I know it because I use that in my game, where an object travels through cubes by shooting a ray and going at their position.
I suggest to have the nodes that can be traveled to only. You do not need all the other nodes.
To achieve that you can do following:
A) determine the “reachable” nodes
B) add a “select-able” object (you node cube) at each of the reachable nodes
when one of them is selected:
C) remember the node that belongs to the selected object
D) remove ALL “select-able” objects
continue with A)
This method separates nodes from the user input (select-able objects). The nodes form the internal model which does not need to be visible. The user input depends of the context (where the camera currently is).
This allows to have several different methods of user interaction (mouse click, keyboard selection …). You can even perform automatic selection via coding.
I hope it helps.
Ah yes, this is perfect. Thanks!
I like your suggestion too, Monster… for now this system seems good enough but if I encounter performance issues I’ll give yours a shot.