- Home /
Two Objects Touching???
Whenever I use this code the variable doesn't change when I'm in the object (The object is a trigger).
var InSuitableArea : int = 0;
function OnCollisionStay (collision : Collision) {
if (collision.collider.tag == "VaultTrigger"){
InSuitableArea = 1;
}
}
Please Help!!!!!
The two objects are my custom first person controller and an invisible trigger.
Answer by Huacanacha · Nov 05, 2013 at 05:55 AM
Try OnTriggerStay instead of OnCollisionStay. There are separate sets of Trigger functions and Collision functions. The trigger functions will be called on both the trigger object and the collider object so this can go in a script on either game object.
Note that the collider hitting the trigger must have a rigidbody attached.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
My character keep walking left. (bug) 0 Answers
state change with button but falls back to previous 2 Answers
Physics Lagspike? 1 Answer
How do you add a fixed joint to a first person controller 1 Answer