WaveVR_RenderModel¶
Contents |
Introduction¶
WaveVR_RenderModel is a generic loader which will dynamically load the FBX and PNG files of the controller model along with the physical controller. Thus, you do not need to redesign the controller model to support another device. As a precondition, all devices follow WaveVR rules.
This script provides customization options for a user.:
Which hand
This refers to Controller_Right or Controller_left.
Default Model
The model is shown if runtime/device service can not provide the FBX/PNG file.
Update dynamically
If this is checked, a render model will change or reload when a real device is different. The default is false.
Merge to one bone
If this is checked, a render model will try to merge meshes in FBX to a single mesh. The default is false.
Sample Scene¶
- RenderModel_test is located in Assets/Samples/RenderModel_test/scenes/
Resources¶
Script WaveVR_RenderModel.cs is located in Assets/WaveVR/Scripts/ControllerModel/
How to Use¶
How to check DS_ASSETS_NOT_FOUND event¶
A render model script also provid a broadcast event when FBX/PNG is not found. You might need to use a customized model if you receive this event.
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.";
}