Jump to content
Happy Holidays! Limited Staff Responses: 1/20 - 1/31 ×

Wave Fade Controller?


natka
 Share

Recommended Posts

Hi ,

 

I receive the instruction from internal and please check if it's what you need.

 

  1. Listen to CONTROLLER_MODEL_LOADED broadcast to receive controller instance.
  2. Find all children of controller.
  3. Find GameObject with beam / pointer in children.
private GameObject rightController = null, leftController = null;void OnEnable(){    WaveVR_Utils.Event.Listen (WaveVR_Utils.Event.CONTROLLER_MODEL_LOADED, OnControllerLoaded);}void OnControllerLoaded(params object[] args){    WVR_DeviceType _type = (WVR_DeviceType)args [0];    if (_type == WVR_DeviceType.WVR_DeviceType_Controller_Right)    {        this.rightController = (GameObject)args [1];        PrintDebugLog ("OnControllerLoaded() right controller:  " + this.rightController.name);    }    if (_type == WVR_DeviceType.WVR_DeviceType_Controller_Left)    {        this.leftController = (GameObject)args [1];        PrintDebugLog ("OnControllerLoaded() left controller:  " + this.leftController.name);    }}void OnDisable(){    WaveVR_Utils.Event.Remove (WaveVR_Utils.Event.CONTROLLER_MODEL_LOADED, OnControllerLoaded);}private void listControllerObjects(GameObject ctrlr){    if (ctrlr == null)        return;    WaveVR_Beam _beam = null;    WaveVR_ControllerPointer _pointer = null;    // Get all children.    GameObject[] _objects = new GameObject[ctrlr.transform.childCount];    for (int i = 0; i < ctrlr.transform.childCount; i++)        _objects[i] = ctrlr.transform.GetChild (i).gameObject;    // Find beam.    for (int i = 0; i < _objects.Length; i++)    {        _beam = _objects [i].GetComponentInChildren<WaveVR_Beam> ();        if (_beam != null)            break;    }    Debug.Log ("Find beam: " + _beam.name);    // Find pointer.    for (int i = 0; i < _objects.Length; i++)    {        _pointer = _objects [i].GetComponentInChildren<WaveVR_ControllerPointer> ();        if (_pointer != null)            break;    }    Debug.Log ("Find pointer: " + _pointer.name);}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...