- Edited
I'm making a 2d platformer shooter, and I want to have the players arm rotate towards the mouse/crosshair. How would I go about doing that? I'm fairly new to Godot, so help would be appreciated
I'm making a 2d platformer shooter, and I want to have the players arm rotate towards the mouse/crosshair. How would I go about doing that? I'm fairly new to Godot, so help would be appreciated
If you're arm has a separate sprite node then in your player script you can do something like this:
onready var arm_sprite = $arm
func _physics_process(delta):
arm_sprite.look_at(get_global_mouse_position())
The look_at() function will rotate the arm sprite towards get_global_mouse_position() which returns the position of the mouse.