targetcollider.cs
772 Bytes
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
public class targetcollider : DefaultTrackableEventHandler
{
public static targetcollider instance;
void Awake() {
if(instance == null) {
instance = this;
}
}
void OnTriggerEnter(Collider other) {
moveTarget();
}
public void moveTarget() {
Vector3 temp;
temp.x = Random.Range(-2f, 2f);
temp.y = Random.Range(1f, 3f);
temp.z = Random.Range(-2f, 2f);
transform.position = new Vector3(temp.x,temp.y,temp.z);
if(DefaultTrackableEventHandler.trueFalse == true) {
RaycastController.instance.playSound(0);
}
}
}