0 votes

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 ' !paxis.isnormalized() ' is true.

in Engine by (362 points)

1 Answer

+1 vote
Best answer

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

by (1,887 points)
selected by

I then get the error:

Parser Error: invalid index 'normalized' in constant expression.

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.

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?

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.

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

You're welcome!

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 Frequently asked questions and 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 [email protected] with your username.