0 votes

So I ran into a weird issue.
When attempting to slerp between two vectors I got a set_axis_angle: The axis Vector3 must be normalized error.

I tried normalising all vectors but it still caused this error to happen.

To my surprise it went away when I used get_global_transform.origin.
This doesn't result in what I intend to do, but for some reason when I use get_transform.origin (a.k.a. local location) it throws this error.
Why? And is there any way to fix it?

in Engine by (48 points)
edited by

Maybe showing us the code would help?

Of course @Ertain!
I will also share the relevant node structure.
But this is the code in question:

var tpLocCurrent = tpCheck.get_transform().origin
var tpAnim = tpLocCurrent.slerp(orient*tpDistance, 0.12)
tpCheck.transform.origin = tpAnim

Note that all variables here are Vector3 types and orient is a vector based on user input that keeps track of where the character is facing. And tpCheck refers to the TpCheck area node.

So basically I have a marker as part of my player scene.
This marker is always ahead of the player and marks where the player will teleport to.
This is the node structure:
node structure

Weirdly however when I replace:

var tpAnim = tpLocCurrent.slerp(orient*tpDistance, 0.12)


var tpAnim = tpLocCurrent.linear_interpolate(orient*tpDistance, 0.12)

It works completely fine and causes no errors, but it isn't exactly the effect I am looking for.

Oh and finally the code given at the start works, exactly as expected with no side effects.
But for some reason it just keeps throwing those errors.
And when I used a global position for tpLocCurrent (see below) instead, it stopped giving those errors...
But it doesn't work as intended at all.

var tpLocCurrent = tpCheck.get_global_transform().origin

I also tried to use .normalize() on all vectors involved but it didn't help either.

Regardless thanks for the reply, have a nice day!

Please log in or register to answer this question.

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.