Forum Discussion
vonbetelgeuse
11 years agoHonored Guest
Struggling to script OVR switch on collision with trigger
Hey guys,
I'm struggling to figure out how to script a change of OVR controller on collision with trigger.
Before I started tinkering I didn't realize the controller is a prefab of two cameras and a series of scripts (total scripting n00b here), so I wrote a script that went like this.
var Camera1 :Camera;
var Camera2 :Camera;
function OnTriggerEnter (col : Collider) {
if(col.gameObject.tag == "Player"){
Camera1.enabled = false;
Camera2.enabled = true;
}
}
I'm not sure what I should classify the variable as, as it can't be one camera as there are two used on each controller.
I'm struggling to figure out how to script a change of OVR controller on collision with trigger.
Before I started tinkering I didn't realize the controller is a prefab of two cameras and a series of scripts (total scripting n00b here), so I wrote a script that went like this.
var Camera1 :Camera;
var Camera2 :Camera;
function OnTriggerEnter (col : Collider) {
if(col.gameObject.tag == "Player"){
Camera1.enabled = false;
Camera2.enabled = true;
}
}
I'm not sure what I should classify the variable as, as it can't be one camera as there are two used on each controller.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 8 months ago