Model

Description

Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts • Server Entity Scripts • Assignment Client Scripts

The Model API provides the ability to manipulate meshes. You can get the meshes for an entity using Entities.getMeshes, or create a new mesh using Model.newMesh.

See also, the Graphics API.

Deprecated: This API is deprecated. Use the Graphics API instead.

Methods

Name Return Value Summary
appendMeshes MeshProxy

Combines multiple meshes into one.

getVertex Vec3 | boolean

Gets the position of a vertex in a mesh.

getVertexCount number | boolean

Gets the number of vertices in a mesh.

meshToOBJ string

Exports meshes to an OBJ format model.

newMesh MeshProxy

Creates a new mesh.

transformMesh MeshProxy | boolean

Transforms the vertices in a mesh.

Method Details

(static) appendMeshes( meshes ) → {MeshProxy}
Returns: The combined mesh.

Combines multiple meshes into one.

Parameters

Name Type Description
meshes Array.<MeshProxy>

The meshes to combine.

(static) getVertex( mesh, index ) → {Vec3|boolean}
Returns: The local position of the vertex relative to the mesh, if valid. false if an error.

Gets the position of a vertex in a mesh.

Parameters

Name Type Description
mesh MeshProxy

The mesh.

index number

The index of the vertex to get.

(static) getVertexCount( mesh ) → {number|boolean}
Returns: The number of vertices in the mesh, if valid. false if an error.

Gets the number of vertices in a mesh.

Parameters

Name Type Description
mesh MeshProxy

The mesh to count the vertices in.

(static) meshToOBJ( meshes ) → {string}
Returns: The OBJ format representation of the meshes.

Exports meshes to an OBJ format model.

Parameters

Name Type Description
meshes Array.<MeshProxy>

The meshes to export.

(static) newMesh( vertices, normals, faces ) → {MeshProxy}
Returns: A new mesh.

Creates a new mesh.

Parameters

Name Type Description
vertices Array.<Vec3>

The vertices in the mesh.

normals Array.<Vec3>

The normals in the mesh.

faces Array.<MeshFace>

The faces in the mesh.

(static) transformMesh( transform, mesh ) → {MeshProxy|boolean}
Returns: The transformed mesh, if valid. false if an error.

Transforms the vertices in a mesh.

Parameters

Name Type Description
transform Mat4

The transform to apply.

mesh MeshProxy

The mesh to apply the transform to.