FBX Models

FBX Models can be exported from various 3D editors and loaded into Heaps. this section.

Exporting

In order to export a FBX model that can be load to HMD, please make sure to:

  • Z-up and -Y-forward axis.
  • -

    Restrictions

    Some restriction apply to the structure of your models when using FBX export:
  • follow property. -

    Load and display

    In order to add a FBX/HMD model to your scene, you need first to load it with the Resource manager. There are two primary ways of doing so.

    Using h3d.prim.ModelCache

    ModelCache class:
    1. // Create a model cachevar cache = new h3d.prim.ModelCache();// Add a model library to cache.// This is optional, because `loadModel` and `loadAnimation` add it to cache automatically.// Returns hxd.fmt.hmd.Librarycache.loadLibrary(hxd.Res.myModel);// Create a model instance. Compared to manual model creation, ModelCache loads textures automatically.var obj = cache.loadModel(hxd.Res.myModel);// Load an animation.var anim = cache.loadAnimation(hxd.Res.myModel);// play it on the objectobj.playAnimation(anim);// Clear the cache instance. Note that cache will dispose all cached model textures as well.cache.dispose();
    texturePath, then, if it fails - relative to passed model. E.g. in case of folder structure like that:
    1. texture.pngmodels/myModel.fbxmodels/texture.png
    texture.png instead of models/texture.png when loading hxd.Res.models.myModel if model requests path as texture.png.

    Manual loading

    Alternatively it is possible to load models directly from Library:
    1. // lib is an hxd.fmt.hmd.Libraryvar lib = hxd.Res.myModel.toHMD();// create the model instance : the loadTexture is a custom function responsible for loading the model texturevar obj = lib.makeObject(loadTexture);// add to the scenes3d.addChild(obj);// load the animationvar anim = lib.loadAnimation();// play it on the objectobj.playAnimation(anim);
    Please note that the HMD library and animations are not cached. If you want to be able to create many instances of the same object in your scene, make sure to cache the values so they can be reused. samples/skin directory.