how to inherit the position of a parent node without the rotation?

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

I have a weapon node as a child of my character and I only want to inherit the position but not the character’s rotation setting the global_rotation in process is not working because the parent is animated with the AnimationPlayer node.

:bust_in_silhouette: Reply From: sash-rc

Updated:

Make sure AnimationPlayer is located higher in scene hierarchy, so its update happens earlier, then for nodes below.
Something like this:

scene
|- AnimationPlayer
|- YourNode
    |- WeaponNode

Some more about it: https://kidscancode.org/godot_recipes/basics/tree_ready_order/

# YourNode
onready var weapon : Node2D = $WeaponNode

func _process(_delta: float) -> void:
    weapon.global_rotation = 15

this works for me

thanks tried to change the AnimationPlayer node process to physics and manual but it didn’t work, and the latter I don’t know how to do that and Im working on 2D

vnmk8 | 2021-07-30 20:02

Updated answer

sash-rc | 2021-07-31 11:38

Thanks i ended up using another method might try this later

vnmk8 | 2021-07-31 19:48