0 votes

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

in Engine by (17 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.