With a navigation mesh in the room, the kit finds paths over its polygons (A*, then the shortest line through the edges crossed):
var path = nav_path(x, y, mouse_x, mouse_y); // [[x, y, kind], …], [] when there is no way
path = nav_path_smooth(path, 24); // round the corners (optional)
nav_points = path;
// each step:
if (!nav_follow(200)) move_and_slide(); // sets velocity_x / velocity_y toward the next point
nav_follow(speed, [arrive])steers alongnav_points, slows down at the end and returns true when done; it works with the kit'smove_and_slide()(orx += velocity_x * studio_delta()).- Agents:
nav_agent_init(speed, radius)in Create,nav_agent_set_target(x, y),nav_agent_step()each step. Agents find the way again now and then and avoid each other: one they would meet in the nextnav_avoid_timeseconds (0.75) is passed on the side away from where they would be closest; agents that overlap are pushed apart. nav_mesh_exists(),nav_path_length(path),nav_mesh_path(x1, y1, z1, x2, y2, z2); 3D:nav_path_3d(...)andnav_agent_init(speed, radius, true).
Related topics
Keys are shown as on the Mac: ⌘ Command, ⌥ Option, ⌃ Control, ⇧ Shift. Studio for Windows shows its own keys beside each menu item.