Godot Version
4.7
I’m attempting to use a ray cast to see if an enemy can see the player and then path find to it but when i enter the area the ray cast goes in the wrong direction, I’ve tried changing the target position to be negative and positive but it wouldn’t change anything
func _on_timer_timeout() → void:
var overlaps = $VisionArea.get_overlapping_bodies()
if overlaps.size() > 0:
for body in overlaps:
if body.is_in_group(“player”):
var playerPostion = body.global_position
$RayCast3D.look_at(playerPostion, Vector3.UP)
$RayCast3D.force_raycast_update()
if $RayCast3D.is_colliding():
var collider = $RayCast3D.get_collider()
if collider.is_in_group(“player”):
nav_agent.set_target_position(playerPostion)
enemy_state = state.chase
it seems to be mirroring it out the back and nothing i’ve tried to change would fix it
using set target position instead of the look at makes it do this

