how to get world axis inside of a rotating object

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

The best example to describe what I want to do is like a gimbal.

I figured out that if I create a Vector inside of a script,
it will rotate with the body.

So for example, Vector3.UP is on the base of my object. And if the object rotate : the Vector3.UP will no longer be the ‘world y axis

I tried rotating the vector opposite to the object rotation, but I experience some strange behaviours.

Is there an easy way of getting the world axis inside of any script ?

I’m visualising my vectors with a RayCast and debug set to ‘Visible collision shapes’