How to Rotate a CharacterBody2D Node in Godot

Godot Version



I have a pickaxe sprite that I want to rotate when the player presses E. After the player releases E, it should return to its original position and disappear.

The problem is, the AnimatedSprite2D and CollisionShape2D (its children) must also rotate along with the pickaxe, and disappear/deactivate whenever E isn’t pressed. I’ve been stuck on this issue for a week, checking docs, and haven’t found anything on rotating CharacterBody2Ds.

Thanks for your help!

Why is that a problem? Child nodes will rotate with their parents by default.

CharacterBody2D is rotated like any other 2D node:

get_node("<NodePath>").rotation_degrees = 90