Answers for "godot 3d slowly rotate towards object"

1

godot 3d slowly rotate towards object

# Slowly rotate towards object in 3D space
func turn_face(target, rotationSpeed, delta):
	var global_pos = global_transform.origin
	var wtransform = global_transform.looking_at(Vector3(target.x,global_pos.y,target.z),Vector3(0,1,0))
	var wrotation = Quat(global_transform.basis).slerp(Quat(wtransform.basis), rotationSpeed*delta)

	global_transform = Transform(Basis(wrotation), global_transform.origin)
Posted by: Guest on June-30-2020

Browse Popular Code Answers by Language