Question by
$$anonymous$$ · Jan 06, 2016 at 05:20 PM ·
c#collider3distrigger
Can not change isTrigger to true
Hello, guys, i can't change the value of the isTrigger to true. When the player collides with an enemy, enemy changes velocity of the player and switches his isTrigger to true to let him fall down (then audio "Game over" will play).
void ResetLevel()
{
if (CheckPoint.ReachedPoint != new Vector3())
player.transform.position = CheckPoint.ReachedPoint;
else {
player.GetComponent<Rigidbody>().velocity = new Vector3(-2.5f, 3.5f);
player.GetComponent<Collider>().isTrigger = true;
}
}
When I collide with an enemy, isTrigger is still equals false.How can I fix it? (also func ResetLevel() are called by OnTriggerEnter)
Comment
Answer by ClearRoseOfWar · Jan 07, 2016 at 02:04 AM
maybe you could just enable the collider: player.GetComponent().enabled = true;
Your answer
Follow this Question
Related Questions
(FIXED) OnTrigger waitforseconds not working. 1 Answer
OnTriggerEnter Issue - Collider problem 0 Answers
Collision or Triggers both not working. 3D. 1 Answer
RayCast From Centre of Camera 1 Answer