- Home /
Question by
Jacques993 · Mar 25, 2014 at 04:36 PM ·
javascriptcolliderplayer
Have script detect which collider
Is there any way to have a script know if the player is in a specific collider?
i.e. if there is 4 room all with 4 box colliders, could you have 1 script and have it loop through depending on which room you are in? i.e.
If Box collider == 1
{
do something
}
In Javascript?
Comment
Answer by Jacques993 · Mar 25, 2014 at 05:25 PM
So this would identify that paticular collider how? Thanks & Sorry for misunderstanding
Answer by RedDevil · Mar 25, 2014 at 05:14 PM
you chould just have diferent tags on the objects you are colliding with and just checking on your script like this:
void OnTriggerEnter(col Collider)
{ if(col.tag == "1") { do something } if(col.tag == " 2") { do something else }