- Home /
Question by
Glitch_Master · Dec 13, 2014 at 11:13 AM ·
colliderbox collidertriggering animation box collider
How Can I Disable box colliders after they are activated?
Im making a fps horror game, and for the jumpscares i use box colliders. I dont want them to keep reactivating if the player was to step back and walk within those boundries again. Any help would be appreciated. Thanks :D
Comment
Are you looking to simply do this?
gameObject.collider.enabled = false;
Actually maybe, All i want is the box collider to deactivate after being activated. Only 1 activation
Answer by SkaredCreations · Dec 13, 2014 at 02:28 PM
Depending on your collider settings ("Is Trigger" checked or not):
void OnTriggerEnter(Collider other) {
collider.enabled = false;
}
void OnCollisionEnter(Collision collision) {
collider.enabled = false;
}
Your answer
Follow this Question
Related Questions
Enemy won't collide with walls using transform.Translate 1 Answer
Collider bug? 0 Answers
How modify a game object's collider? 1 Answer
Move position of box collider using javascript 1 Answer
My 2 Objescts doesnt collide 1 Answer