0 votes

Can anyone please post a code example how to make
proper use of Quaternion (especially SLERP) in GDScript?
Thank you in advance!

in Engine by (35 points)

1 Answer

0 votes
Best answer

I'll post an example code here

var lookDir = get_node(lookTarget).get_transform().origin - t.origin 
var rotTransform = t.looking_at(lookDir,Vector3(0,1,0))
var thisRotation = Quat(t.basis).slerp(rotTransform.basis,value)
value += delta
if value>1:
    value = 1

You can take a look at here for a detailed math.

by (750 points)
selected by

Very special thanks for this information and your answer!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.