Version: 2.0.2

Model

Description

The Model component renders a static or animated 3D model in your scene. Lumin Runtime uses a proprietary material file format called a kmat to bind materials to renderable surfaces. When creating your model, ensure you use <material_name>.kmat to reference the material. Your textures are referenced in the kmat file. We recommend creating kmat files with the Lumin Runtime Editor.

Example

<Model
modelPath={"resources/turkey4.fbx"}
materialPath={"resources/turkey.kmat"}
texturePaths={["resources/turkey_baseColor.png"]}
defaultTextureIndex={0}
defaultTextureSlot={"albedo"}
defaultMaterialName={"turkey_material"}
animation={{ name: "idle" }}
animationPauseState={false}
animationPlaybackSpeed={1.0}
/>
  • FBX file format is currently supported on Magic Leap One.

Common Events

Common Properties

Create Properties

NameTypeDefault ValueDescription
modelPathstringn/aFile name of the model resource to load. By default this is assumed to be a relative path from the executable file.
materialPathstringn/aFile name of the material resource to load. By default this is assumed to be a relative path from the executable file.
importScalenumber1.0The scale that is applied to this resource.
texturePaths[string]n/aAn array of file names of the texture resources. By default this is assumed to be a relative path from the executable file.
defaultTextureIndexnumbern/aDefault index from the texturePaths.
defaultTextureSlotstringn/aThe texture slot, such as Albedo or Normal.
defaultMaterialNamestringn/aThe name of the material.

Element Properties

NameTypeDescription
animationPauseStatebooleanSets the animation pause state for the current model node.
animationPlaybackSpeednumberSets the playback speed for animations.
animationTimenumberSets the current time of the animation.
modelResourceIdnumberSets the ID of the resource this node draws. The ID refers to a ModelResource.
animationobjectSets the current animation by resource + name. Some animation resources contain multiple animations. These are addressed by animation name. FBX models, for example, may contain 1-n animations.
textureobjectSets the texture of a given material by the new texture ID. Material should be the one applied to the Model Node.

animation

{
resourceId: <number>,
name: <string>,
paused: <boolean>,
loops: <number>
}

texture

{
textureId: <number>,
textureSlot: <string>,
materialName: <string>
}

defaultTextureSlot options: TextureType

texture.textureSlot options: TextureType