0 votes

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.

Godot version v3.3.1.stable.official
in Engine by (430 points)
edited by

1 Answer

+1 vote
Best answer

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

by (1,438 points)
selected by

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

Updated answer

Thanks i ended up using another method might try this later

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.