• Functions and messages for interacting with model components.

See ModelProperties for related properties. See ModelMessages for related messages.

Static methods

staticcancel(url:UrlOrString):Void

  • Cancel all animation on a model.

Parameters:

url

the model for which to cancel the animation

@:native("get_aabb")staticgetAabb(url:HashOrStringOrUrl):ModelAabb

  • Get the axis-aligned bounding box (AABB) for the entire model in local space.

Parameters:

url

the model component

Returns:

AABB information with min and max as Vector3

@:native("get_go")staticgetGo(url:UrlOrString, boneId:HashOrString):Hash

  • Retrieve the game object corresponding to a model skeleton bone.

The returned game object can be used for parenting and transform queries. This function has complexity O(n), where n is the number of bones in the model skeleton. Game objects corresponding to a model skeleton bone can not be individually deleted. Only available from .script files.

Parameters:

url

the model to query

boneId

id of the corresponding bone

Returns:

id of the game object

@:native("get_mesh_aabb")staticgetMeshAabb(url:HashOrStringOrUrl):Table<Hash, ModelAabb>

  • Get the axis-aligned bounding boxes (AABB) for all meshes in the model, in local space.

Returns a table mapping mesh id (hash) to AABB information.

Parameters:

url

the model component

Returns:

table mapping mesh id hash -> AABB

@:native("get_mesh_enabled")staticgetMeshEnabled(url:HashOrStringOrUrl, meshId:HashOrStringOrUrl):Bool

  • Get the enabled state of a mesh

Parameters:

url

the model

meshId

the id of the mesh

Returns:

true true if the mesh is visible, false otherwise

@:native("play_anim")staticplayAnim(url:UrlOrString, animId:HashOrString, playback:GoPlayback, ?playProperties:Null<ModelPlayAnimProperties>):Void

  • Play an animation on a model.

Parameters:

url

the model for which to play the animation

animId

id of the animation to play

playback

playback mode of the animation

playProperties

optional table with properties

@:native("reset_constant")staticresetConstant(url:UrlOrString, name:HashOrString):Void

  • Reset a shader constant for a model.

The constant must be defined in the material assigned to the model. Resetting a constant through this function implies that the value defined in the material will be used. Which model to reset a constant for is identified by the URL.

Parameters:

url

the model that should have a constant reset

name

of the constant

@:native("set_constant")staticsetConstant(url:UrlOrString, name:HashOrString, value:Vector4):Void

  • Set a shader constant for a model component.

The constant must be defined in the material assigned to the model. Setting a constant through this function will override the value set for that constant in the material. The value will be overridden until model.reset_constant is called. Which model to set a constant for is identified by the URL.

Parameters:

url

the model that should have a constant set

name

name of the constant

value

value of the constant

@:native("set_mesh_enabled")staticsetMeshEnabled(url:HashOrStringOrUrl, meshId:HashOrStringOrUrl, enabled:Bool):Void

  • Enable or disable visibility of a mesh.

Parameters:

url

the model

meshId

the id of the mesh

enabled

true if the mesh should be visible, false if it should be hidden