- Home /
Other
Make one object able to go through an object. But the other unable too?
Hello! I have a vent cover like object that has a collider. I want the player to be able to get through the collider. But make the enemys unable to. How do i do this?
Answer by SohailBukhari · May 11, 2017 at 06:49 AM
Place another collider in front of vent cover and Check tag if player found then Check IsTrigger option to true on the vent cover collider and unchecked IsTrigger option to false when enemy(tag) collides with the collider.
Collider.isTrigger = true;
Other way is that check distance from player and when player comes near to collider check IsTrigger option to true otherwise make it false.
If your characters are moving using some AI then after trigger you can stop moving that they not pass from collider.
Hello Sohail, Thanks for your answer. It really help me a lot for a beginner like me. Can you describe more detail how to apply the collider?
what you mean by apply collider. if you want to attach collider component on the object then simply you can ad collider by add component button in the inspector.
Follow this Question
Related Questions
ignoreing enemy collisions when hit, and turning the coliders back on 1 Answer
Network.player giving me 0 0 Answers
How do i make my player die? 2 Answers