I’m creating a Sokoban game and I want that my player push the crate.
I found how to detect if there is a game object in front of the cube, but I don’t know how to get the name/tag of the cube, so I can’t push the crate.
Actual code :
checkPosition = transform.position + Vector3(0f,32f,0f);
hitColliders = Physics.OverlapSphere(checkPosition, 1);
if(hitColliders.length < 1)
transform.position.y += 32f;
Sorry for the faults, English is not my mother language.