- Home /
Question by
ardizzle · Jan 12, 2014 at 03:32 PM ·
javascriptcollidertrigger
Collider not detecting trigger
I have an object that when it detects the trigger im suppose to be able to place it. But no matter what I seem to do is doesn't respond. So I took my script and put it on my player and it detected the player perfectly. The object I place has a collider not triggered. Where im trying to place is triggered. Im lost :(
Here is the script im using:
#pragma strict
var intendedPosName : String;
var canPlace : boolean = false;
function Start ()
{
canPlace = false; // This is so that game doesn't start out letting you place the object anywhere.
}
function Update ()
{
}
function OnTriggerEnter(col : Collider)
{
if(col.name == intendedPosName)
{
print("I entered");
}
}
function OnTriggerStay(col : Collider)
{
if(col.name == intendedPosName)
{
canPlace = true;
}
}
Comment
I have made progress? The building works perfect if I had a Character Controller on it.
Your answer
Follow this Question
Related Questions
Enable objects to enter the trigger 2 Answers
Can a object without a rigidbody be triggered by a trigger? 1 Answer
Boolean detection on collision. 1 Answer
Script not responding to key press immediately. 1 Answer
Script error: OnTriggerEnter 1 Answer