Skip to main content

Model3D

Description:

  Class used for rendering a glTF 3D model.

Inherits from: Node3D.

speed​

Type: Field.

Description:

  The playback speed multiplier of the current animation.

Signature:

speed: number

duration​

Type: Readonly Field.

Description:

  The duration of the current animation in seconds.

Signature:

const duration: number

elapsed​

Type: Readonly Field.

Description:

  The elapsed playback time of the current animation in seconds.

Signature:

const elapsed: number

playing​

Type: Readonly Field.

Description:

  Whether an animation is currently playing.

Signature:

const playing: boolean

paused​

Type: Readonly Field.

Description:

  Whether the current animation is paused.

Signature:

const paused: boolean

animationCount​

Type: Readonly Field.

Description:

  The number of animation clips in this model.

Signature:

const animationCount: integer

materialCount​

Type: Readonly Field.

Description:

  The number of per-instance material slots.

Signature:

const materialCount: integer

getAnimationName​

Type: Function.

Description:

  Gets an animation clip name by zero-based index.

Signature:

getAnimationName: function(self: Model3D, index: integer): string

hasNode​

Type: Function.

Description:

  Checks whether an imported glTF node with the given name exists.

Signature:

hasNode: function(self: Model3D, name: string): boolean

attachToNode​

Type: Function.

Description:

  Attaches a user-owned Node3D below an imported node.

Signature:

attachToNode: function(self: Model3D, name: string, child: Node3D): boolean

getLocalBoundsMin​

Type: Function.

Description:

  Gets the current model-space bounds minimum.

Signature:

getLocalBoundsMin: function(self: Model3D): Vec3

getLocalBoundsMax​

Type: Function.

Description:

  Gets the current model-space bounds maximum.

Signature:

getLocalBoundsMax: function(self: Model3D): Vec3

getWorldBoundsMin​

Type: Function.

Description:

  Gets the current world-space bounds minimum.

Signature:

getWorldBoundsMin: function(self: Model3D): Vec3

getWorldBoundsMax​

Type: Function.

Description:

  Gets the current world-space bounds maximum.

Signature:

getWorldBoundsMax: function(self: Model3D): Vec3

getMaterial​

Type: Function.

Description:

  Gets a per-instance material slot by zero-based index.

Signature:

getMaterial: function(self: Model3D, index: integer): Material3D | nil

play​

Type: Function.

Description:

  Plays an animation by name.

Signature:

play: function(self: Model3D, name?: string, loop?: boolean --[[false]]): number

Parameters:

ParameterTypeDescription
namestring[optional] The animation name. Uses the default animation when omitted.
loopboolean[optional] Whether the animation should loop. Default is false.

Returns:

Return TypeDescription
numberThe animation duration in seconds, or 0 when not found.

stop​

Type: Function.

Description:

  Stops the current animation.

Signature:

stop: function(self: Model3D)

pause​

Type: Function.

Description:

  Pauses the current animation.

Signature:

pause: function(self: Model3D)

resume​

Type: Function.

Description:

  Resumes the paused animation.

Signature:

resume: function(self: Model3D)