I'm trying to use 3d path finding with navmesh tiles and gridmaps.
In my mesh library i have plane tiles, each of which is a mesh instance (plane) with navigationMeshInstance as its child.
In the main scene, the tree is:
This works for nodes which move along paths towards targets whose global transforms are set in code.
BUT, the player node is to move along a path from whatever its position towards a clicked point (point and click movement).
I'm using this function to return the target point for the player node:
func raycast_from_mouse(mouse_position, collision_mask):
var ray_start = camera.project_ray_origin(mouse_position)
var ray_end = ray_start + camera.project_ray_normal(mouse_position) * ray_length
var space_state = get_world().direct_space_state
return space_state.intersect_ray(ray_start, ray_end, , collision_mask)
I then set the collision mask in a separate function which returns a 'collider' point towards which to move.
This method works great for baked navmeshes but the raycast doesn't seem to be colliding with meshlib tiles... Anyone know why?