The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

im trying to make a "homing rocket" in my 3d game, i want the homing rocket to not hit any objects and fly to the enemy even if he is 1000 pixels above the ground, but I couldnt find a way to do it with navigation node because it only allows the rocket to fly on a singel y axis while i want it to be able to fly anywhere around the world without hitting walls.
any suggestions?

Godot version 3.4.5
in Engine by (12 points)

Much depends on how sparse your world is - if it's not a maze, you could cast a few rays in front of the rocket and change direction if there's a wall.

If it's more complicated, a tutorial for full path finding solution in 3d space might just be out of scope for q&a site :D

My map is gonna be too complicated for raycasts but thanks anyways for the suggestion.
I searched all over YouTube and Google but couldn't find single solution that fits, everything was with only one y layer, which is good for enemy running towards you, but for a homing missile it's not.

1 Answer

0 votes

Thankfully, most pathfinding algorithms should be possible to implement in higher dimensions. Many of them work on node structure, which is agnostic to actual geometry.

Harder problem might be generating the dataset needed, unless your world happens to be voxel based (3d grid). You could try casting cube shapes via intersect_shape (docs) at points of a rectangular grid to make a voxel representation of places rocket can or cannot go. Run astar or similiar algorithm then on this data. Performance/quality adjustments come from the fidelity of the voxel grid.

by (1,100 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.