Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | CalJFish |
Hello, I have an enemy that has a raycast that is always looking at the player “LOS” and when the player enters the raycast range it triggers the enemy pathfinding.
I would also like to make it so the enemy has another raycast “aim” that rotates and follows the LOS but at a slower speed.
I have the following script here along with a turnspeed constant and the aim raycast
if player:
los.look_at(player.global_position)
check_player_detection()
if playerSpotted:
generate_path()
navigate()
move()
I believe it would be something like
aim.rotate(los.rotation * turnspeed)
but i dont know the exact coding to make it properly follow instead of spinning around non stop
Thanks