- Home /
OnTriggerStay weird behavior
In my game I am attempting to do a simple parkour system. This system includes a rectangular detection collider in front of the player, and that is a trigger. When the game detects that the trigger hits something, then the game shoots out a raycast to see if the object is short enough to climb over. For some reason, the trigger only detects collisions that is the right size, that is, not an object too short, and not an object that is too tall. Is there a way to fix this? Here is a picture of a 'just right' size object of which the game can actually detect:
Here is one of an object that is too tall:
And similar outcomes appear for objects that are short, like the one to the left of the green cube in the 'just right' picture. I sadly cannot upload a screenshot of that because of UA's restrictions.
Here is the script that I am using for the 'detected' variable:
#pragma strict
var detected : boolean = false;
function OnTriggerStay(other : Collider){
if(other.gameObject.tag != "Player" && other.gameObject.tag != "NPC"){
detected = true;
}
}
function OnTriggerExit(other : Collider){
if(other.gameObject.tag != "Player" && other.gameObject.tag != "NPC"){
detected = false;
}
}
Any help is appreciated, -william9518
You will probably need to provide the script you are using
Your answer

Follow this Question
Related Questions
Can't click gameobject when over another trigger? 1 Answer
Collider not working as trigger when painted into the scene 0 Answers
Triggering platform animation on colliding with Button 0 Answers
Use trigger with player but have a collider with everything else? 3 Answers
How do you go from one scene, to another, then a third and back again ? 0 Answers