Rotating from local axis.

v4.2.2.stable.mono.official [15073afe3]

I’ve been looking for an answer for something more general rather than to something specific, but couldn’t find anything so I am asking here.

extends Node3D

var speed : Vector3 = Vector3(0, 50, 0)

func _process(delta):
	rotation_degrees += speed * delta

This is what I’ve come up with, I wanted to attach a video of how it behaves but apparently new users can’t attach files.

Just imagine a slanted ball where the slant angle rotates.

The behavior I want is where the slant angle stays in the same direction but the ball rotates in the new angle - local axis rotation, I believe is the right terminology.

Again, this is more of a general question, because I want to animate things but this specific behavior I’ve found hard to animate smoothly - manually keeping the angle in the same direction looks all wobbly.

I am not sure if this should be obvious or not so I apologize if it is.

Thanks in advance.

If I understand this correctly, you want to axes for your ball rotation.
For this, you could use another node for separating two rotation axes (/pivots).

so instead of having e.g. the following hierarchy

Parent
→ Ball

you would have

Parent
RotationAxis
→ → Ball

Now you can rotate the new axis and the ball would rotate around the axis. Hope this is what you are looking for?

Wow! That actually worked! It was really that simple!

Thank you so much - hopefully this will help others who had the same problem I had.

Have a hopefully nice day! Again, thank you so much!!

1 Like