dot big bang

Developer API
Menu

Class VoxelObjectComponent

All
  • Public
  • Public/Protected
  • All

Hierarchy

Index

Constructors

constructor

Properties

castShadow

castShadow: boolean

Whether the VoxelObject casts shadows on itself and other objects when rendererd.

Readonly color

color: Color

The tint color (default is white).

Readonly emissive

emissive: Color

The emissive color (default is black).

emissiveIntensity

emissiveIntensity: number

The emissive intensity (default is 1.0).

Readonly id

id: string

The 36-character identifier string of the Component. The id is unique within the Entity is belongs to. Currently, the same id may be used by another Component on a different Entity.

ignoreFog

ignoreFog: boolean

Whether the voxel object is hidden when inside fog See this.game.renderer.fog for more info on fog

isWorldOffset

isWorldOffset: boolean

If true, the offset is expressed along the world-space axes (going through the origin of the Entity). If false, the offset is expressed along the local axes of the Entity. Look at offset property for more information.

offset

offset: Vector3

The offset from the Entity origin where the voxel object should be rendered. If isWorldOffset is true, that axes is in world-space (going through the origin of the Entity). If it is false, it is the local axes of the Entity. The value of the offset is expressed in the local Entity's space unit.

opacity

opacity: number

The opacity level, between 0 (fully transparent, i.e invisible) and 1 (fully opaque), at which the VoxelObject is rendered. This is used to make the VoxelObject see-through.

play

play: boolean

Indicates whether the animation is automatically played on the VoxelObject by the component. When set to true, the component updates its own time property based on the playbackRate property (this assumes that a VoxelObject is set, if that's not the case, there's nothing to play). When set to false, the VoxelObject appears immobile in the pose specified by the time property and playbackRate has no effect.

playbackRate

playbackRate: number

The rate at which the animation of the VoxelObject is played by the component (assuming that a VoxelObject is set, and play is true). A rate of 1 means that the animation is played at its default speed as intended by its author, while a rate of 0.5 is half speed, a rate of 2 is twice the speed, etc... A negative value plays the animation backwards.

time

time: number

The current time position in the animation, in seconds.

Readonly type

The type of the Component.

visible

visible: boolean

Whether the voxel object should be rendered or not.

visibleInDepthPass

visibleInDepthPass: boolean

Whether the VoxelObject will be rendered in the ambient occlusion pass of the Renderer (?).

voxelObject

voxelObject: null | VoxelObject

The VoxelObject to render.

Accessors

entity

  • Gets the Entity the Component is part of. This throws an exception if the Component is not in an Entity. Use the isInEntity property to test for that.

    Returns Entity

game

  • Gets the Game the Component is part of (via the Entity it belongs to). This throws an exception if the Component is not in the game. Use the isInGame property to test for that.

    Returns Game<{ saveData: SaveData<any, any> }>

isInEntity

  • get isInEntity(): boolean
  • Returns true if the Component is part of an Entity.

    Returns boolean

isInGame

  • get isInGame(): boolean
  • Returns true if the Component is part of the Game (via the Entity it belongs to).

    Returns boolean

Methods

showVoxelFrameAtKey

  • showVoxelFrameAtKey(keyIndex: number): void
  • Updates the time property to display the VoxelObject frame at the animation key specified by its index in the sequence. If the index is negative the first key is used. If it's greater than the number of keys, the last key is used. This method does nothing if this component doesn't point to a VoxelObject (i.e the voxelObject property is null).

    Parameters

    • keyIndex: number

      The index of the animation key in the VoxelObject sequence which frame we want to display.

    Returns void