- Home /
Question by
Bentoon · Sep 02, 2014 at 04:15 AM ·
cameracollisionontriggerenterboolean
triggering visibility with camera path
Hello people I finally got all my planes visibility triggering on and off as my camera goes back & forth on a path. banging my head against boolean
but it works! However
I'm moving my camera with touch & Arrow keys and sometime it just doe ant register .... Dammmit
I'm using the Mesh collider (& rigid body on planes (the box collier sends 2 tiggers
Here is my code and a little picture I drew for you before I figured it out the first time:
using UnityEngine;
using System.Collections;
public class cameraCollistion : MonoBehaviour {
public GameObject Brand;
public GameObject Spoke;
public GameObject MBFW;
public bool switchOne = false;
public bool switchTwo = false;
void OnTriggerEnter (Collider other) {
if(other.tag == "one")
{
if (switchOne == false){
print("one");
MBFW.SetActive(false);
Brand.SetActive(true);
}
else if(switchOne == true){
print("four");
MBFW.SetActive(true);
Brand.SetActive(false);
}
switchOne = true;
}
if(other.tag == "two")
{
if (switchTwo == false){
print("two");
Brand.SetActive(false);
Spoke.SetActive(true);
}
else if(switchTwo == true){
print("three");
Brand.SetActive(true);
Spoke.SetActive(false);
}
switchTwo = true;
}
}
}
Thanks ~ be
campath.jpg
(25.1 kB)
Comment