I have a character that has a object the player can put this object in the ground. I was thinking about a system that can the detect the y and x position of the object on collision. But how do i do this? Or is there a much simple way.
Hi, place this on you character script and it should output the position of the gameobject in the Debug Window. Remember to change the Tag name to the Tag name of the object you want to detect the position of :
function OnCollisionEnter (other : Collision) {
//Replace -> Tag name here
//With the name of your object
if (other.gameObject.tag == "Tag name here") {
//Display position of object in the Debug Console
Debug.Log(other.gameObject.transform.position);
}
}