Collision Flashcards
1
Q
public bool isOnground = true;
A
private void OnCollisionEnter (Collision collision)
{
isOnground =true;
}
2
Q
public bool gameOver = false;
A
private void OnCollisionEnter (Collision collision)
{
if (collision.gameObject.CompareTag(“Ground”))
{
isOnground = true;
} else if (collision.gameObject.CompareTag(“Obstacle”))
{
gameOver = true;
Debug.Log(“Game Over!”);
}
}