I want to send Spike1 to 0.0.0 when the character and Collision1 object collide in unity. Can you help me?
You should use the OnTriggerEnter method and inside you should check if the collision has been between the character and the collider that you wanted ( collision1).
Then inside this if statement you have to send spike1 to the 0.0.0, you can do it by doing “Spike1.transform.position = new Vector3(0,0,0);”
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Collision : MonoBehaviour
{
public GameObject Spike1;
void OnTriggerEnter (Collider Other)
{
if(Other.CompareTag("Character")) //remember to set the tag
{
Spike1.transform.position = new Vector3(0,0,0);
}
}
}
The script has to be inserted in the “collision1” object .
That’s how i would do it. Let me know if it works for you!