Version: 3.0.0
Model
- Lumin
- iOS
- Android
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
Name | Type | Default Value | Required | Description |
---|---|---|---|---|
modelPath | string | n/a | File name of the model resource to load. By default this is assumed to be a relative path from the executable file. | |
materialPath | string | n/a | File name of the material resource to load. By default this is assumed to be a relative path from the executable file. | |
importScale | number | 1.0 | N | The scale that is applied to this resource. |
texturePaths | [string] | n/a | An array of file names of the texture resources. By default this is assumed to be a relative path from the executable file. | |
defaultTextureIndex | number | n/a | Default index from the texturePaths. | |
defaultTextureSlot | string | n/a | The texture slot, such as Albedo or Normal . | |
defaultMaterialName | string | n/a | The name of the material. |
Element Properties
Name | Type | Default Value | Description |
---|---|---|---|
animationPauseState | boolean | false | Sets the animation pause state for the current model node. |
animationPlaybackSpeed | number | n/a | Sets the playback speed for animations. |
animationTime | number | n/a | Sets the current time of the animation. |
modelResourceId | number | n/a | Sets the ID of the resource this node draws. The ID refers to a ModelResource. |
animation | object | n/a | Sets 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. |
texture | object | n/a | Sets 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>
}