How i can respawn a object after touch the water?
This will move on object back to its original position and rotation when it hits an object tagged ‘Water’:
private Transform origTrans;
void Start() {
origTrans = transform.position;
}
void OnTriggerEnter(Collider other) {
if(other.gameObject.tag == "Water") {
trasform.position = origTrans;
}
}
But without information what you really want to do, I have no idea if that is what you’re asking for.
Set up a trigger on the water.
When the trigger is hit, spawn/instantiate whatever object you need. If it’s the player, you can just move the player object back to the start/spawn position.
This will move on object back to its original position and rotation when it hits an object tagged ‘Water’:
private Transform origTrans;
void Start() {
origTrans = transform.position;
}
void OnTriggerEnter(Collider other) {
if(other.gameObject.tag == “Water”) {
trasform.position = origTrans;
}
}
But without information what you really want to do, I have no idea if that is what you’re asking for.
Thanks.What i must write where is “other”?