WaveVR_RenderModel

Contents

Introduction

WaveVR_RenderModel is a generic loader which will dynamically load FBX and PNG files of the controller model by physical controller device, developer doesn’t need to redesign the controller model to support another device. All devices are followed by WaveVR rules is precondition, please refer to How to make controller model

_images/1d.png

This script provides customization options for the user.:

  • Which hand

Controller_Right or Controller_left to be used.

  • Default Model

The model show if runtime/device service can’t provide FBX/PNG file.

  • Update dynamically

If this is checked, render model will change or reload when real device is different. Default is false.

  • Merge to one bone

If this is checked, render model will try to merge meshes in FBX to single mesh. Default is false.

Sample Scene

  • RenderModel_test: in Assets/Samples/RenderModel_test/scenes/

Resources

Script WaveVR_RenderModel.cs in Assets/WaveVR/Scripts/ControllerModel/

How to Use

How to check DS_ASSETS_NOT_FOUND event

Render model script also provided a broadcast event when FBX/PNG is not found, developer should handle this event if model can’t be loaded.

void OnEnable()
{
#if UNITY_EDITOR
    if (Application.isPlaying)
    {
        return;
    }
#endif

    WaveVR_Utils.Event.Listen(WaveVR_Utils.Event.DS_ASSETS_NOT_FOUND, onAssetNotFound);
}

void OnDisable()
{
#if UNITY_EDITOR
    if (Application.isPlaying)
    {
        return;
    }
#endif
    WaveVR_Utils.Event.Remove(WaveVR_Utils.Event.DS_ASSETS_NOT_FOUND, onAssetNotFound);
}

// Use this for initialization
void Start () {
    GameObject.Find("Asset").GetComponent<Text>().text = "";
}

private void onAssetNotFound(params object[] args)
{
    WVR_DeviceType eventType = (WVR_DeviceType)args[0];
    GameObject.Find("Asset").GetComponent<Text>().text = "Controller model asset is not found in DS.";
}