Skip to content

niBillboardNode⚓︎

This node adjusts its render-time orientation so that the local z axis will face the camera. It supports multiple modes: camera parallel, or rotation around the local Y axis.

This type inherits the following: niNode, niAVObject, niObjectNET, niObject

Properties⚓︎

alphaProperty⚓︎

Convenient access to this object's alpha property. Setting this value to be nil will erase the property, while setting it to a valid alpha property will set (or replace) it.

Returns:


appCulled⚓︎

A flag indicating if this object is culled. When culled, it will not render, and raycasts ignore it.

Returns:

  • result (boolean)

children⚓︎

Read-only. The children of the node. Can have nil entries.

Returns:


controller⚓︎

Read-only. The first controller available on the object.

Returns:


effectList⚓︎

Read-only. The effect list of the node. Attached effects affect the node and all of its child subtree geometry.

Returns:


extraData⚓︎

Read-only. The first extra data available on the object.

Returns:


flags⚓︎

Flags, dependent on the specific object type.

Returns:

  • result (number)

fogProperty⚓︎

Convenient access to this object's fog property. Setting this value to be nil will erase the property, while setting it to a valid fog property will set (or replace) it.

Returns:


materialProperty⚓︎

Convenient access to this object's material property. Setting this value to be nil will erase the property, while setting it to a valid material property will set (or replace) it.

Returns:


mode⚓︎

The orientation mode. Maps to values in ni.billboardMode table.

  • 0 Always face camera. Local z-axis becomes parallel to the camera. Minimizes rotation difference from the previous frame for smoother motion.
  • 1 Rotate about up vector. The object is rotated around its local y-axis so that its z-axis is pointing towards the camera.
  • 2 Rigid face camera. Local z-axis becomes parallel to the camera. Does not depend on previous frame.

Returns:


name⚓︎

The human-facing name of the given object.

Returns:

  • result (string)

parent⚓︎

Read-only. The object's parent. It may not have one if it is not attached to the scene.

Returns:


properties⚓︎

Read-only. The list of properties attached to this niAVObject.

Returns:


refCount⚓︎

Read-only. The number of references that exist for this object. When this value reaches zero, the object will be deleted.

Returns:

  • result (number)

rotation⚓︎

The object's local rotation matrix.

Returns:


RTTI⚓︎

Read-only. The runtime type information for this object. This is an alias for the .runTimeTypeInformation property.

Returns:


runTimeTypeInformation⚓︎

Read-only. The runtime type information for this object.

Returns:


scale⚓︎

The object's local uniform scaling factor.

Returns:

  • result (number)

stencilProperty⚓︎

Convenient access to this object's stencil property. Setting this value to be nil will erase the property, while setting it to a valid stencil property will set (or replace) it.

Returns:


texturingProperty⚓︎

Convenient access to this object's texturing property. Setting this value to be nil will erase the property, while setting it to a valid texturing property will set (or replace) it.

Returns:


translation⚓︎

The object's local translation vector.

Returns:


velocity⚓︎

The object's local velocity.

Returns:


vertexColorProperty⚓︎

Convenient access to this object's vertex coloring property. Setting this value to be nil will erase the property, while setting it to a valid vertex coloring property will set (or replace) it.

Returns:


worldBoundOrigin⚓︎

The world coordinates of the object's bounds origin.

Returns:


worldBoundRadius⚓︎

The radius of the object's bounds.

Returns:

  • result (number)

worldTransform⚓︎

The object's transformations in the world space.

Returns:


zBufferProperty⚓︎

Convenient access to this object's z-buffer property. Setting this value to be nil will erase the property, while setting it to a valid z-buffer property will set (or replace) it.

Returns:


Methods⚓︎

addExtraData⚓︎

Appends an extra data to the object.

myObject:addExtraData(extraData)

Parameters:


attachChild⚓︎

Attaches the child to the children list of the node. Doesn't check to see if the object is already in the child list.

myObject:attachChild(child, useFirstAvailable)

Parameters:

  • child (niAVObject)
  • useFirstAvailable (boolean): Default: false. Use the first available space in the list. If false appends the child at the end of the list.

attachEffect⚓︎

Attaches a dynamic effect to the node. It will not attach the same effect twice.

myObject:attachEffect(effect)

Parameters:


attachProperty⚓︎

Attaches a property to this object, without checking to see if the property or another of its type is already on the list. Property lists must not have more than one property of a given class (i.e. no two niTexturingProperty objects) attached at once, or else undefined behavior will result.

myObject:attachProperty(property)

Parameters:


clearTransforms⚓︎

Resets the object's local transform.

myObject:clearTransforms()

clone⚓︎

Creates a copy of this object.

local result = myObject:clone()

Returns:


copyTransforms⚓︎

Update object's local transform by copying from another source.

myObject:copyTransforms(source)

Parameters:


createBoundingBox⚓︎

Calculates and creates a bounding box for the object. The existing bounding box, if any, will not be used, a fresh one will always be calculated.

local boundingBox = myObject:createBoundingBox()

Returns:


detachAllChildren⚓︎

Detaches all children from the children list of the node.

myObject:detachAllChildren()

detachAllEffects⚓︎

Detaches all dynamic effect from the effect list of the node.

myObject:detachAllEffects()

detachAllProperties⚓︎

Detaches all the properties on the object and returns them in the table.

local result = myObject:detachAllProperties()

Returns:


detachChild⚓︎

Detaches the child from the children list of the node. Returns the detached child.

local detachedChild = myObject:detachChild(child)

Parameters:

Returns:


detachChildAt⚓︎

Detaches the child at the specified index from the children list of the node. Returns the detached child.

local detachedChild = myObject:detachChildAt(index)

Parameters:

  • index (integer)

Returns:


detachEffect⚓︎

Detaches the given dynamic effect from the effect list of the node, if it was present. Has no effect if the effect wasn't attached to the node.

myObject:detachEffect(effect)

Parameters:


detachProperty⚓︎

Detaches and returns a property from the object which matches the given property type.

local result = myObject:detachProperty(type)

Parameters:

Returns:


getEffect⚓︎

Gets the effect of the given type.

local effect = myObject:getEffect(type)

Parameters:

Returns:


getGameReference⚓︎

Searches for an niExtraData on this object to see if it has one that holds a related reference.

local reference = myObject:getGameReference(searchParents)

Parameters:

  • searchParents (boolean): Default: false. If true, all parent objects (if applicable) are also searched.

Returns:


getObjectByName⚓︎

Searches this node and all child nodes recursively for a node with a name that matches the argument.

local result = myObject:getObjectByName(name)

Parameters:

  • name (string)

Returns:


getProperty⚓︎

Gets an attached property by property type.

local result = myObject:getProperty(type)

Parameters:

Returns:


getStringDataStartingWith⚓︎

Searches for an niExtraData on this object to see if it has niStringExtraData that has its string start with the provided value argument.

local extra = myObject:getStringDataStartingWith(value)

Parameters:

  • value (string): The first niStringExtraData starting with this value will be returned.

Returns:


getStringDataWith⚓︎

Searches for an niExtraData on this object to see if it has niStringExtraData that has the provided value argument in its string field.

local extra = myObject:getStringDataWith(value)

Parameters:

  • value (string): The first niStringExtraData with this word will be returned.

Returns:


hasStringDataStartingWith⚓︎

Searches for an niExtraData on this object to see if it has niStringExtraData that has its string start with the provided value argument. Returns true if the value was found.

local result = myObject:hasStringDataStartingWith(value)

Parameters:

  • value (string): The value to search for.

Returns:

  • result (boolean)

hasStringDataWith⚓︎

Searches for an niExtraData on this object to see if it has niStringExtraData that contains the provided value argument in its string field. Returns true if the value was found.

local result = myObject:hasStringDataWith(value)

Parameters:

  • value (string): The value to search for.

Returns:

  • result (boolean)

isAppCulled⚓︎

Recursively checks if either the object or any of its parents are appCulled.

local result = myObject:isAppCulled()

Returns:

  • result (boolean)

isFrustumCulled⚓︎

Checks if the object is frustum culled for the given camera.

local result = myObject:isFrustumCulled(camera)

Parameters:

Returns:

  • result (boolean)

isInstanceOfType⚓︎

Determines if the object is of a given type, or of a type derived from the given type.

local result = myObject:isInstanceOfType(type)

Parameters:

Returns:

  • result (boolean)

isOfType⚓︎

Determines if the object is of a given type.

local result = myObject:isOfType(type)

Parameters:

Returns:

  • result (boolean)

prependController⚓︎

Add a controller to the object as the first controller.

myObject:prependController(controller)

Parameters:


propagatePositionChange⚓︎

Alias for update() method. Updates the world transforms of this node and its children, which makes changes visible for rendering. Use after changing any local rotation, translation, scale, bounds or after attaching and detaching nodes.

Tip

It's best to "batch up" calls to this method. For example, when transform of an object its parent and grandparent are all changed during the same frame, it is much more efficient to call this method only on the grandparent object after all transforms have been changed. Also, consider calling this function as low as possible on a scene graph.

myObject:propagatePositionChange({ time = ..., controllers = ..., bounds = ... })

Parameters:

  • args (table): Optional.
    • time (number): Default: 0. This parameter is the time-slice for transformation and bounds updates
    • controllers (boolean): Default: false. Update object's controllers?
    • bounds (boolean): Default: true. Update object's bounds?

removeAllControllers⚓︎

Removes all controllers.

myObject:removeAllControllers()

removeAllExtraData⚓︎

Removes all extra data.

myObject:removeAllExtraData()

removeController⚓︎

Removes a controller from the object.

myObject:removeController(controller)

Parameters:


removeExtraData⚓︎

Removes a specific extra data from the object.

myObject:removeExtraData(extraData)

Parameters:


rotateToCamera⚓︎

Updates the world transform to point at a camera. Used automatically during rendering. This method is only needed when you need to get the world transform without rendering.

myObject:rotateToCamera(camera)

Parameters:


saveBinary⚓︎

Serializes the object, and writes it to the given file.

local success = myObject:saveBinary(path)

Parameters:

  • path (string): The path to write the file at, relative to the Morrowind installation folder.

Returns:

  • success (boolean): If true the object was successfully serialized.

setFlag⚓︎

Sets a given flag in the niObjectNET flag data. The specifics use of the flag is dependent on the real underlying type.

myObject:setFlag(state, index)

Parameters:

  • state (boolean)
  • index (number)

update⚓︎

Updates the world transforms of this node and its children, which makes changes visible for rendering. Use after changing any local rotation, translation, scale, bounds or after attaching and detaching nodes.

Update Efficiency

It's best to "batch up" calls to this method. For example, when transform of an object its parent and grandparent are all changed during the same frame, it is much more efficient to call this method only on the grandparent object after all transforms have been changed. Also, consider calling this function as low as possible on a scene graph.

myObject:update({ time = ..., controllers = ..., children = ... })

Parameters:

  • args (table): Optional.
    • time (number): Default: 0. This parameter is passed to controllers. Only needed if controllers are being updated.
    • controllers (boolean): Default: false. Update controllers before updating transforms.
    • children (boolean): Default: true. Recursively updates the children of this node.

updateEffects⚓︎

Update all attached effects. This method must be called at or above any object when dynamic effects are attached or detached from it

myObject:updateEffects()

updateProperties⚓︎

Update all attached properties.

myObject:updateProperties()

Functions⚓︎

new⚓︎

Creates a new, empty niBillboardNode, with the mode set to rotate about the model-space up vector.

local node = niBillboardNode.new()

Returns: