So I'm looking for a good/proper way to keep a "grabbed" item at a position that's relative to the player.
I currently have a solution, but this involves moving the
.position of the target object to the
global_position of the player's position. I read that changing the
_physics_process is bad, but I tried putting that position setting line inside
_integrate_forces of the target object, but it gave wonky physics when combined with my throw logic.
Is there a better way to keep position a foreign object? I've thought of either duplicating that object and making it a child of the player, or change the parent node of the target object (which is currently the child of the "level") to the player object.
But I couldn't come up with a solution for either.
func processAction ():
var areas = $Area2D.get_overlapping_areas()
# this throws the item
picked_item.grabbed = false
picked_item.new_impulse = Vector2(800, -300)
print("picked item false")
picked_item = null
picked_item = areas.top
picked_item.grabbed = true
picked_item.position = $AboveHead.global_position