Make a particular sprite ignore look_at?

Godot Version

4.3

Question

I have a body, and legs. Body might switch between animations like idle, run, attack etc. What I wanted to do is for the legs to ignore the mouse position, instead of rotating like the Body is.

How can I achieve this? I’ve tried to to change look_at to $body.look_at but that resulted in a wrong rotation and still affected the legs anyway.

Marker2D is under Player (CharacterBody2D), Body (Sprite2D) is under Marker2D and Legs (Sprite2D) are under Body.

Here’s my code for the Marker2D:

extends Marker2D

func _process(delta: float) -> void:
	look_at(get_global_mouse_position())

And also Body is using a separate AnimationPlayer, while legs are using AnimationPlayer2

I would maybe make use of RemoteTransform2D that is a sibling of the Legs and points to the legs. You can disable rotation inside of the RemoteTransform2D when needed


Referencing https://www.reddit.com/r/godot/comments/clsna8/how_to_make_child_node_ignore_parent_rotation/

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.