Condition ' !p_axis.is_normalized() ' is true.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dumuz

I just don’t understand why this isn’t working…

onready var t1 = $test1 #just a meshinstance

func _process(delta):
	t1.rotate(Vector3(0,0,-10), .1)

The mesh is gone and this error is polluting the debugger: Condition ’ !p_axis.is_normalized() ’ is true.

:bust_in_silhouette: Reply From: johnygames

Instead of t1.rotate(Vector3(0,0,-10), .1), write t1.rotate(Vector3(0,0,-10).normalized(), .1)

I then get the error:

Parser Error: invalid index ‘normalized’ in constant expression.

Dumuz | 2019-12-27 23:50

Oops! My bad, it should have been:

t1.rotate(Vector3(0,0,-10).normalized(), .1)

Forgot to add the parentheses at the end of the normalized method.

johnygames | 2019-12-27 23:58

Ah, there we go.

Unfortunately that is not what I thought it was. But you answered my question. So, thank you very much!
Do you perhaps know to how to make a 3D object rotate around another object it is not a child or parent of?

Dumuz | 2019-12-28 00:05

I am not sure how to do that, but let’s say you have a planet and you want a satelite to revolve around it. A quick and dirty way would be this:

  1. Create a Position3D node and place it at the center of the planet.

  2. Have the Position3D node update its rotation any way you like.

  3. Make the Position3D node a parent to the satelite.

  4. Place the satelite as far or close as necessary to the planet.

  5. Voila! Your satelite revolves around the Position3D node, which in turn rotates the way you like. That way you also avoid making the planet a direct parent to the satelite.

For a more advanced way, read up on this:

I am not sure, but I think this atan method looks promising. You could also google “Godot orbit”, since what you want is technically orbital movement. I hope this helps.

johnygames | 2019-12-28 00:40

Oh man, you think I would have thought of that process with my animation background. Lol. Thanks man, you’re a real help!

Dumuz | 2019-12-28 00:53

You’re welcome!

johnygames | 2019-12-28 00:56