Positioning The Tool Correctly

Godot Version

v4.3.stable.steam

Problem

How can I correctly position the hammer, so the end of the hammer is exactly where the mouse is?

func _physics_process(delta):
	handleMovement(delta)
	
	var mouse_position = get_global_mouse_position()
	
	var direction = mouse_position - hammer.global_position
	var target_angle = direction.angle()
	
	var current_angle = hammer.global_rotation
	var new_angle = lerp_angle(current_angle, target_angle, delta * hammer_rotation_speed)
	hammer.global_rotation = new_angle
	
	var hammer_position = hammer_bone.global_position
	var distance_from_hammer = mouse_position.distance_to(hammer_position) + 30
	var new_position = hammer_position - (distance_from_hammer * direction.normalized())
	hammer.global_position = new_position 

Positive Direction

Negative Direction

wouldn’t you use hammer.global_position = get_global_mouse_position()? Could you share a picture of what you want it to look like?

Haha Hello, so I actually figured it out. I can’t show you what I changed but briefly and basically I found the distance between the hammer and the mouse position character and subtracted that by 30 which was the hammer’s length multiplied it by the direction of the mouse.

The result I wanted was something like Getting Over it, thank you though for replying!