I am new to game design & development.
I am now trying to collide objects that are not players.
I have a player and it holds an item. I want the item move together with the player.
So I refresh its position whenever the player changes position, like this:
var chg:= Vector2(-51,0) # item is in front of the character
item.transform = $Position2D.global_transform.translated(chg)
I want the item to collide with objects like the player who holds it.
Collision layer and mask is selected identical to the player.
But since the object is transformed (and not moved) , it does not collide. It just transforms to the new position.
How can I make it collide and stop when it hits some object in the same layer ?
(and also stop the player of course)