Scripting API

Home Scripting API Index Class Overview

com.nolimitscoaster

Class SceneObjectElement


public class SceneObjectElement
extends Object

Represents a sub-object or layer (LWO) of a scene object

The element's transformation (rotation, scale, translation) is relative to the owning scene object.

Method Summary

nlvm.math3d.Matrix4x4f getAbsoluteMatrix()
  Gets the element's absolute transformation matrix.
nlvm.math3d.Vector3f getAbsoluteTranslation()
  Gets the element's absolute translation.
void getEntityColor(int slot, nlvm.math3d.Vector4f color)
  Gets a specific element's entity color.
nlvm.math3d.Matrix4x4f getMatrix()
  Gets the element's rotation,scale,translation as a transformation matrix.
String getName()
  Returns the name of this element as specified in the 3d object
void setAutospriteRotationAngle(float f)
  Sets the element's autosprite rotation angle (in radians).
void setEntityColor(int slot, nlvm.math3d.Vector4f color)
  Sets a specific element's entity color.
void setEntityColor(nlvm.math3d.Vector4f color)
  Sets the element's entity color at slot 0.
void setMatrix(nlvm.math3d.Matrix4x4f matrix)
  Sets the element's rotation,scale,translation using a transformation matrix.
void setRotation(float pitchRad, float headingRad, float bankingRad)
  Sets the element's rotation using pitch/heading/banking
void setRotation(float angle, float axisX, float axisY, float axisZ)
  Sets the element's rotation using angle and axis
void setRotation(float angle, nlvm.math3d.Vector3f axis)
  Sets the element's rotation using angle and axis
void setRotation(nlvm.math3d.Vector3f pitchHeadBank)
  Sets the element's rotation using pitch/heading/banking
void setScale(float x, float y, float z)
  Sets the element's scale
void setScale(nlvm.math3d.Vector3f v)
  Sets the element's scale
void setTextureAnimationIndex(int n)
  Sets the texture animation frame index for all materials the element is using.
void setTranslation(float x, float y, float z)
  Sets the element's translation
void setTranslation(nlvm.math3d.Vector3f v)
  Sets the element's translation
void setVisible(bool bVisible)
  Sets if this element should be visible. Can be used to hide objects.


Method Detail


getAbsoluteMatrix

public final nlvm.math3d.Matrix4x4f getAbsoluteMatrix()

Gets the element's absolute transformation matrix.

Behaviour is undefined when using key frame animation playback.

Returns:
    Absolute transformation matrix. Never null. Object is a copy of internal state and can be modified by the caller.


getAbsoluteTranslation

public final nlvm.math3d.Vector3f getAbsoluteTranslation()

Gets the element's absolute translation.

This method gets the absolute transformation matrix and returns the translation vector of it. Similar to getAbsoluteMatrix().getTrans(), but faster. Behaviour is undefined when using key frame animation playback.

Returns:
    Absolute translation vector. Never null. Object is a copy of internal state and can be modified by the caller.

Since:
    2.6.2.0


getEntityColor

public final void getEntityColor(int slot, nlvm.math3d.Vector4f color)

Gets a specific element's entity color.

The entity colors are custom colors that can be accessed in NL2MAT materials. They can be used for all kinds of effects. There are up to 8 colors per object.

Parameters:

slot - the slot index, needs to be 0..7
color - Vector which will receive red, green, blue, alpha intensities (0..1). Must not be null. RGB values are in gamma space.

Since:
    2.2.5.8


getMatrix

public final nlvm.math3d.Matrix4x4f getMatrix()

Gets the element's rotation,scale,translation as a transformation matrix.

The element's transformation (rotation,scale,translation) is relative to its parent element and owning scene object. Behaviour is undefined when using key frame animation playback.

Returns:
    Transformation matrix. Never null. Object is a copy of internal state and can be modified by the caller.


getName

public final String getName()

Returns the name of this element as specified in the 3d object

Returns:
    name of element


setAutospriteRotationAngle

public final void setAutospriteRotationAngle(float f)

Sets the element's autosprite rotation angle (in radians).

Default is 0. Will affect all faces of this element, using the Autosprite deform vertices material setting.


setEntityColor

public final void setEntityColor(int slot, nlvm.math3d.Vector4f color)

Sets a specific element's entity color.

The entity colors are custom colors that can be accessed in NL2MAT materials. They can be used for all kinds of effects. There are up to 8 colors per object.

Parameters:

slot - the slot index, needs to be 0..7
color - Vector with red, green, blue, alpha intensities (0..1). Must not be null. RGB values are in gamma space.

Since:
    2.2.4.0


setEntityColor

public final void setEntityColor(nlvm.math3d.Vector4f color)

Sets the element's entity color at slot 0.

The entity colors are custom colors that can be accessed in NL2MAT materials. They can be used for all kinds of effects. There are up to 8 colors per object.

Parameters:

color - Vector with red, green, blue, alpha intensities (0..1). Must not be null. RGB values are in gamma space.

setMatrix

public final void setMatrix(nlvm.math3d.Matrix4x4f matrix)

Sets the element's rotation,scale,translation using a transformation matrix.

The matrix must contain rotation,scale,translation only (no shear, no projection etc.) The matrix will be decoded internally into rotation,scale and translation parts. The element's transformation is relative to its parent element and owning scene object. Behaviour is undefined when using key frame animation playback.


setRotation

public final void setRotation(float pitchRad, float headingRad, float bankingRad)

Sets the element's rotation using pitch/heading/banking

The element's rotation is relative to the rotation of the owning scene object. The pitch/heading/banking will be translated into angle and axis internally Behaviour is undefined when using key frame animation playback.


setRotation

public final void setRotation(float angle, float axisX, float axisY, float axisZ)

Sets the element's rotation using angle and axis

angle is in radians. The element's rotation is relative to the rotation of the owning scene object. Behaviour is undefined when using key frame animation playback.


setRotation

public final void setRotation(float angle, nlvm.math3d.Vector3f axis)

Sets the element's rotation using angle and axis

angle is in radians. The element's rotation is relative to the rotation of the owning scene object. Behaviour is undefined when using key frame animation playback.


setRotation

public final void setRotation(nlvm.math3d.Vector3f pitchHeadBank)

Sets the element's rotation using pitch/heading/banking

All angles are in radians. The element's rotation is relative to the rotation of the owning scene object. The pitch/heading/banking will be translated into angle and axis internally. Behaviour is undefined when using key frame animation playback.


setScale

public final void setScale(float x, float y, float z)

Sets the element's scale

Behaviour is undefined when using key frame animation playback.

Parameters:

x - the x scale
y - the y scale
z - the z scale

Since:
    2.2.5.8


setScale

public final void setScale(nlvm.math3d.Vector3f v)

Sets the element's scale

Behaviour is undefined when using key frame animation playback.

Parameters:

v - the scale vector, must not be null

setTextureAnimationIndex

public final void setTextureAnimationIndex(int n)

Sets the texture animation frame index for all materials the element is using.

By default the texture animation frame is played in a loop automatically. This method can be used to show a specific animation frame. The default value is -1 which will play the animation automatically.

Parameters:

n - The texture animation frame starting from 0. Set it to a negative value to continue playing the animation automatically.

Since:
    2.2.3.5


setTranslation

public final void setTranslation(float x, float y, float z)

Sets the element's translation

The element's translation is relative to the translation and rotation of the owning scene object. All values in meters. Behaviour is undefined when using key frame animation playback.

Parameters:

x - the x translation
y - the y translation
z - the z translation

Since:
    2.2.5.8


setTranslation

public final void setTranslation(nlvm.math3d.Vector3f v)

Sets the element's translation

The element's translation is relative to the translation and rotation of the owning scene object. All values in meters. Behaviour is undefined when using key frame animation playback.

Parameters:

v - the translation vector, must not be null

setVisible

public final void setVisible(bool bVisible)

Sets if this element should be visible. Can be used to hide objects.