Topic was automatically imported from the old Question2Answer platform.
Asked By
cenullum
Old Version
Published before Godot 3 was released.
I saw it is possible with tilemap and navigation2d . I couldn’t do it for 3d enemy move to player. White planes that on air for navigation mesh
Maybe some of this can help you solve your problem:
a) Navigation mesh should be connected, navigation node will not create a path between disconnected meshes.
b) When connecting navigation meshes make sure mesh vertices align perfectly
c) Don’t call get_simple_path on every _fixed_process call, it will hit performance
d) Use get_closest_point to get the initial point (and maybe end point too)
davidoc | 2017-08-17 15:52
Is enemy must be upside of navigation or same y pos?
cenullum | 2017-08-18 05:37
I usually set the feet of my entities at Y=0 and in this case they are postioned at navigation Y level, it’s a similar setup as the one you find at the Platformer 3D demo. Also remember to multiply your velocity with the delta and remove points once your entity reaches them (and only calculate the path if you reached the end)
An example of the generated level in the game ‘Archipelago’.
It is easy to realize if the level is in the same plane.
elif create_state == 1:
for ob_x in range(-17, 18):
for ob_z in range(-17, 18):
var transl = Vector3(ob_x, 2, ob_z)
get_node('Navigation/navmesh').set_translation(transl)
if not Vector3(ob_x, 0, ob_z) in obj_pose_list:
var transf = get_node('Navigation/navmesh').get_global_transform()
get_node('Navigation').navmesh_create(get_node('Navigation/navmesh').get_navigation_mesh(), transf, self)
get_node('Navigation/navmesh').queue_free()
create_state = 2
does it check your height of rocks for dont move over rocks ? In above video we are manually add moveable places by floor tile with navigation2d
During level generation, the objects inside the game field are arranged exactly along the cells. The positions of the objects are listed. During the creation of the navigation grid, the positions of the objects are ignored.
Tort | 2017-08-21 15:07
so there arent grid on positions of the objects that listed?
cenullum | 2017-08-22 11:14
See the script. obj_pose_list - list of positions occupied by objects compiled before the creation of the navmesh. This is for building a navmeshd in automatic mode. But you can try to take a mesh from a gridmap.