Godot Version
4.2.2
Question
Hello! I recently started using Godot after using Unity for several years. I’ve started a simple first person project to test some things out, but I keep encountering really strange behavior with the look_at function.
I’ve combed through a bunch of threads and tutorials for the last several hours, but am completely stuck as to why this function won’t work like how I expect.
For example, I created a very simple object called the ‘looker’, which is meant to act like a turret that looks at the player:
This object has a very simple script that should just make it track the player:
func _process(delta):
var player = get_node("/root/Node3D/Player/player_body")
look_at(player.position)
In game, it takes on a totally wrong rotation:
I’ve tried messing around with the second parameter for look_at, changing the rotation of the object in the scene, changing the rotation edit mode, and more. Some of these tweaks do change how the object rotates, but nothing seems to actually make this work as I would expect. I feel like I must be missing something.