Quat in Godot 4: it is Quaternion now
Quat is called Quaternion in Godot 4, and Basis.get_rotation_quat() is get_rotation_quaternion(). In a Godot 4 project, Quat(axis, angle) fails to parse with Function "Quat()" not found in base self. Did you mean to use "Quaternion()"?.
AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.
Intel or AMD Chromebook, with Linux turned on.
What Godot is checking
Quat was a built-in type, so Godot 3 code calls it like a constructor, Quat(...). Godot 4 renamed the type, and the analyzer reads the old name as a call to a function that does not exist; because the name is in the renames table, it suggests the new one.
Quaternion(axis, angle) still builds a rotation from an axis and an angle in radians, and slerp() still interpolates between two rotations. A Node3D's quaternion property reads and sets its rotation as one.
Reproduce it
A Godot 3 rotation built with Quat(), in a Godot 4 project.
extends Node
func _ready():
var q = Quat(Vector3.UP, PI / 2)
print(q)
What Godot 4.7.2 prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
SCRIPT ERROR: Parse Error: Function "Quat()" not found in base self. Did you mean to use "Quaternion()"?
at: GDScript::reload (res://answers/quat-in-godot-4/repro.gd:4)
ERROR: Failed to load script "res://answers/quat-in-godot-4/repro.gd" with error "Parse error".
at: load (modules/gdscript/gdscript_resource_format.cpp:46)Fix it
A quarter turn around Y as a Quaternion, applied to a vector.
extends Node
func _ready() -> void:
var q := Quaternion(Vector3.UP, PI / 2)
print((q * Vector3.FORWARD).snappedf(0.001))
print(Quaternion.IDENTITY.slerp(q, 0.5).get_angle(), " rad halfway")
What the fixed script prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
(-1.0, 0.0, 0.0)
0.78539770841599 rad halfwayRun this fix with your agent
Flockbay is the Godot editor with an AI agent built in. Paste this into Flockbay's chat, or into Claude Code or Codex connected to Flockbay over MCP: the agent finds the cause in your project, applies the fix, runs the game headless and reads Godot's output to check it.
My Godot project was written for Godot 3 and Godot 4 stops on this: "Parse Error: Function "Quat()" not found in base self. Did you mean to use "Quaternion()"?". Port every use to Godot 4. Quat is called Quaternion in Godot 4, and Basis.get_rotation_quat() is get_rotation_quaternion(). In a Godot 4 project, Quat(axis, angle) fails to parse with Function "Quat()" not found in base self. Did you mean to use "Quaternion()"?. Then run the game headless and check Godot's output for errors.Verified on Godot 4.7.2
Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 18 October 2026, and the output above is what Godot printed, unedited.
Where the check lives in Godot's source: gdscript_analyzer.cpp line 3767, the message with its hint, renames_map_3_to_4.cpp line 1435, Quat to Quaternion, Quaternion class reference.
Questions
- How do I get a Node3D's rotation as a quaternion?
- Read its quaternion property, or basis.get_rotation_quaternion().
- Why use a quaternion instead of rotation_degrees?
- Interpolating between two orientations with slerp() takes the shortest path and avoids gimbal lock.
Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.
Download Flockbay free