Quaternion rotation is frame dependent
This code is frame dependent: 1
extends Node3D
var spin := Quaternion.from_euler(Vector3(1, 1, 1))
func _process(delta: float) -> void:
quaternion *= spin * deltaThis is because spin is a
Quaternion, and multiplying it by delta
only does a component-wise multiplication. This
results in frame-dependent rotation, where the speed
of the rotation is different depending on how high
the framerate is. In order to scale the rotation,
use slerp. For example: 2
func _process(delta: float) -> void:
quaternion *= Quaternion.IDENTITY.slerp(spin, delta)