Version: 3.0.0

Model

<Model> on lumin

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

import React from "react";
import { Model, View, Prism, Scene } from "magic-script-components";
export default class MyApp extends React.Component {
render() {
return (
<Scene>
<Prism size={[1, 1, 0.2]} >
<View name="main-view" alignment={'center-center'}>
<Model
localScale={[0.3, 0.3, 0.3]}
localRotation={[0.2, 0.38268346, 0.0, 0.9238795]}
modelPath={require('../../resources/static.glb')}
/>
</View>
</Prism>
</Scene>
);
}
}
  • FBX file format is currently supported on Magic Leap One.

Common Events

Common Properties

Create Properties

NameTypeDefault ValueRequiredDescription
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.0NThe 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

NameTypeDefault ValueDescription
animationPauseStatebooleanfalseSets the animation pause state for the current model node.
animationPlaybackSpeednumbern/aSets the playback speed for animations.
animationTimenumbern/aSets the current time of the animation.
modelResourceIdnumbern/aSets the ID of the resource this node draws. The ID refers to a ModelResource.
animationobjectn/aSets 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.
textureobjectn/aSets 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