14 Sept 2025
Author: Me

Godot LookAtModifier3D Tutorial

I tried the new LookAtModifier3D node that came with the version 4.4 of Godot and found it incredibly easy to use, solving a problem that used to be considerably more involved previously. This is a node that helps you make a 3d skeleton look at some other node in a realistic way, seamlessly blending with the model’s existing animation.

I’ll explain here the steps to make a simple demonstration of this new node.

Project Setup

We need a functional Skeleton3D first. I downloaded one from Mixamo, which is a free animation library that lets you download fully animated, fully rigged fbx files. If you’d like to do the same, login to Mixamo and select a model, then an animation, then choose to download it as fbx. Then put it inside your Godot project folder and drag-and-drop into your viewport. You’ll need to click on the “Open in Editor” button and create a new node that inherits from it to be able to edit it.

Let’s also throw in a Camera3D and an empty Node3D to the main scene. Rename the latter to “LookTarget”.

Adding the LookAtModifier3D Node

We can start by adding a LookAtModifier3D as the child of the Skeleton3D node inside your body scene. Name it “LookAtModifierHead” and select your head bone for the field “Bone Name” in the inspector. Leave the target node blank for now since we’ll add that in the script.

With 1 LookAtModifier3D, our skeleton will only turn its head. Which is fine if that’s all you want but otherwise add another LookAtModifier3D, rename it to “LookAtModifierSpine”, then choose your spine bone this time. This is so the model turns its entire body, not just the head.

But wait, we don’t want the spine to turn as much as the head. That’d be too jarring and unnatural. To fix it, adjust the “Influence” field in the inspector under the “SkeletonModifier3D” dropdown. I chose 0.5. This affects how much the spine will turn.

Adding Scripts

Add a script to the body root node like below:

extends Node3D

@export var look_target: Node3D

func _ready():
	if look_target:
		$RootNode/Skeleton3D/LookAtModifierHead.target_node = look_target.get_path()
		$RootNode/Skeleton3D/LookAtModifierSpine.target_node = look_target.get_path()

We’re just setting the target_node as the look_target. It expects the node path, hence the get_path calls.

Now you can go to your main scene and choose the LookTarget node from before as the look_target in the inspector.

Next, add a script to the LookTarget itself:

extends Node3D

@export var camera: Camera3D
@export var turn_speed: float = 2.0

const MAX_DISTANCE: float = 10.0
var target_position: Vector3

func _input(event):
	if event is InputEventMouseMotion:
		update_look_target(event.position)

func update_look_target(mouse_position: Vector2):
	var from = camera.project_ray_origin(mouse_position)
	var direction = camera.project_ray_normal(mouse_position)
	target_position = from + direction * MAX_DISTANCE

func _process(delta):
	global_position = global_position.lerp(
		Vector3(
			target_position.x,
			target_position.y,
			global_position.z,
		),
		turn_speed * delta
	)

Here we’re moving around the LookTarget based on mouse movement. We’re only setting the x and y, leaving z the same.

Note that I also added a lerp for a smoother turn, which you can control the speed of with the turn_speed variable.

With that, go ahead and assign the camera in the inspector.

Result

You should now be able to run your main scene and watch your model turn to look at your cursor as you move your mouse around. And that’s it!

If you’d like to see my working example that you can run on your browser and interact with, you can find it at Godot LookAtModifier3D Example.


Godot
Game Dev
3d
Animation
Tutorial
secondary banner background