How to rotate a spatial node locally

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

The title is self explanatory
I need to know how to rotate a spatial node attached to the player locally because I’ve been having this problem when the player look s the other way around the rotation shifts
For an example:
I want to rotate this node to the right of the player (90 degrees) when i press “move left” key it works fine but when i look the other direction and press the “move left” it goes to opposite way
Here’s how the code looks like:

If Input.is_action_pressed("move_left"):
     pivot.rotation_degrees = lerp(pivot.rotation_degrees, 90, 0.1)
:bust_in_silhouette: Reply From: Skipperro

I’m pretty sure I don’t understand it. Maybe sending a screenshot of your scene would make this more clear. Or maybe a bit more of the code?

Generally if you rotate parent node, all child nodes will move with it to stay on the same place relative to parent. If you need to rotate just a child node, you run ChildNode.rotate() and it will rotate itself without modifying parent.

I’m making a wild guess here, that if you rotate parent, you rotate it not horizontally, but vertically, and they your child node (pivot?) it upside down and “rotate left” is still valid in its point of reference.
Imagine looking at spinning Earth and then looking at it upside-down. It still spins in same direction, but you see it differently.