slerp can't work with normalized vectors ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Inces
func face(iprogress,predir):
	var target =vars.facing[predir].normalized()
	var start = vars.facing[currentfacing].normalized()

	var vec = start.slerp(target,iprogress)    ##!##
	global_transform = global_transform.looking_at(vec,Vector3.UP) 

At commented line I get :
E 0:00:01.915 set_axis_angle: The axis Vector3 must be normalized.

func works through process(), and this error seems to accumulate exponentially.
I tried putting normalize() at every vector introduced around that function, nothing changes. Also, this error doesn’t crash project, first interpolations seem to actually work ??

The error indicates a problem with a set_axis_angle() call (which IS documented to require a normalized vector). The code line you point to is not where the offending call is being made.

jgodfrey | 2022-12-15 15:10

This is where editor highlights it. I understood that set_axis_angle() is called under the hood via slerp() method, since I don’t call it anywhere in my code.
Actually error is gone after I ensured slerp doesnt get two identical vectors as arguments…

Inces | 2022-12-15 15:52

Interesting… As you mentioned, this can be recreated by setting the two vectors in question to the same values.

jgodfrey | 2022-12-15 18:15

I just discovered, that slerping vectors3 is broken in 3.5. Editor can’t interpolate not only identical vectors, but also any vectors with the same direction ( meaning inverse vectors ).
I had to decompose vectors to vector2, slerp it, and construct vector3 from the result. It Only now it works completely fine…

Inces | 2022-12-17 11:44

If you think you’ve discovered a bug, I’d suggest you report it on GitHub to ensure that it gets fixed in the future. See here for some instructions.

jgodfrey | 2022-12-17 15:04

:bust_in_silhouette: Reply From: Barrrettt

if the two vectors are equal then the error is raised.
Check the two vectors before using slerp.

var vec = start
if start!=target:
    vec = start.slerp(target,iprogress) 

Yeah thanks, I discovered it as in answers above. This must ba a bug, no ? Since slerping vectors2d doesn’t require them to be equal

Inces | 2023-01-04 20:41