What does the other in OnTriggerEnter/Stay/Exit mean?
I am writing a script to change gravity when the player enters a button, But my OnTriggerWnter/Stay/Exit is not working and my guess to why is that 'other' as the second parameter does not include my player GameObject. I was wondering if i should put something else, The players tag is 'Player' and the layer is 'player' a sample of the code is posted below. Thanks for the help .
using UnityEngine;
using System.Collections;
public class FlipZone : MonoBehaviour {
public bool canFlip = false;
void OnTriggerEnter(Collider)
{
Debug.Log("Player has entered trigger");
}
void OnTriggerStay(Collider)
{
canFlip = true;
Debug.Log("Player is in trigger");
}
void OnTriggerExit(Collider other)
{
Debug.Log("Player left trigger");
canFlip = false;
}
}
I have another script for movement and flipping the gravity.
Your answer
Follow this Question
Related Questions
Locking the player movement and fading out when entering a trigger 0 Answers
Character hangs on the end of colliders? 0 Answers
Destroying Object OnTriggerEnter2D not working 1 Answer
Player Movement Goes Crazy When Hit On Side Of Moving Platform 0 Answers
Rigidbody player movement doesn't response to gravity 0 Answers