Detect whether a Rigidbody collided with a Trigger
I'm trying to create a script to do that when the player collides with a trigger again starting position of the game, but I'm not able to detect the collision.
Answer by hexagonius · Sep 12, 2015 at 10:02 PM
Collider and Trigger result in OnTriggerEnter, not OnCollisionEnter.
Answer by lloladin · Sep 24, 2015 at 09:03 AM
you cant detect if a rigidbody is colliding you have to make a 2DCollider for the player and the object you want to collide with for the code you could tag the Objects like give the Player the Player tag and the object lets say ground then in the playerController Script
write soemthign like this
void OnTriggerEnter2D (Collider other)
{
if (other.tag == "ground")
{
do soemthign
}
}
hope this solve it :)
Your answer
Follow this Question
Related Questions
Cannot delay player respawn. 2 Answers
Teleport 2D Character on TriggerEnter 2 Answers
CS1216 error 0 Answers