How to project an Empty mesh on a surface for a grappling hook mechanic?


Hey guys and gals! I wanna try to make a prototype for a 3D platforming game with a grappling hook mechanic, although I may have a small issue in the coding department. The idea I have for throwing the grappling hook would be first to project an Empty (we’ll call it the Target) on a surface pointed with an input, and then move another Empty (which is hooked to my grappling hook end, the other end being constrained to a simple cube on my prototype) at a given speed to the coordinates of the Target. After that, well, you press the same input again and the grappling hook is retracted.

So the main issue is: how to move an Empty object instantly to the nearest surface pointed by the mouse? I can handle the rest, it’s just that particular issue that’s bugging me…

Have a nice day, y’all, and thanks in advance for the answer


Hey @RocketPunk! It is actually pretty easy. For an example of how to do mouse picking in code and logic nodes checkout this example: Physics Picking.

And here is an node example that will put the cube where you click:


Be aware that in order to detect a click on an object it must have a rigid body trait applied to it. Have fun! :smiley: