API Docs for: 0.5.5
Show:

kick.scene.Transform Class

Position, rotation and scale of a game object. This component should not be created manually. It is created when a GameObject is created.

KickJS uses a right handed coordinate system.

Methods

activated

()

Abstract method called when a component is added to scene. May be undefined.
This method method works in many cases like a constructor function, where references to other game objects can be looked up (this cannot be done when the actual constructor function is called, since the scene may not be loaded completely).
Note that activated are called just after update methods on all components has been called - this makes it easier to get references to other components.

deactivated

()

Abstract method called when a component is removed from scene. May be undefined.

getGlobalMatrix

() kick.math.Mat4

Returns:

kick.math.Mat4:

global transform

getGlobalTRSInverse

() kick.math.Mat4

Return the inverse of global rotate translate transform

Returns:

kick.math.Mat4:

inverse global transform

getLocalMatrix

() kick.math.Mat4

Return the local transformation matrix

Returns:

kick.math.Mat4:

local transformation

getLocalTRSInverse

() kick.math.Mat4

Return the local inverse of translate rotate scale

Returns:

kick.math.Mat4:

inverse of local transformation

lookAt

(
  • transform
  • up
)

Changes the rotation of the object to look at input (Transform) object.

Parameters:

markGlobalDirty

() private

Mark the global transform updated. This will mark the transform updated (meaning the global transform must be recomputed based on translation, rotation, scale)

render

(
  • engineUniforms
  • [overwriteMaterial]
)

Abstract method called every at every rendering of the object. May be undefined.

Parameters:

str

() String

Returns:

String:

stringify JSON

toJSON

() Object

Inherited from kick.scene.Component but overwritten in kick/scene/Transform.js:368

Returns:

Object:

JSON formatted object

update

()

Abstract method called every update. May be undefined.

Properties

aabb

kick.math.Aabb

Defines the axis aligned bounding box used for view frustum culling May be undefined or null.

children

Array_kick.scene.Transform

Array of children. The children should not be modified directly. Instead use the parent property

componentType

String final

Inherited from kick.scene.Component but overwritten in kick/scene/Transform.js:270

Name of the component type = "transform".

Example:

 var transform = gameObject.transform;

gameObject

kick.scene.GameObject

The gameObject owning the component. Initially undefined. The value is set when the Component object is added to a GameObject

localPosition

kick.math.Vec3

Local position.

localRotation

kick.math.Quat

Local rotation in quaternion.

localRotationEuler

kick.math.Vec3

Local rotation in euler angles.

localScale

kick.math.Vec3

Local scale. Any zero value will be replaced with an epsilon value.

parent

kick.scene.Transform

Parent transform. Initial null.

position

kick.math.Vec3

Global position.

renderOrder

Number

Default value is 1000
< 1999 default geometry
1999 skybox
2001 - 2999 transparent geometry (sorted back-to-front when rendered)
> 3000 overlay geometry rendered on top

rotation

kick.math.Quat

Global rotation in quaternion.

rotationEuler

kick.math.Vec3

Global rotation in euler angles.

scriptPriority

Number

Components with largest priority are invoked first. (optional - default 0). Cannot be modified after creation.

Events

componentUpdated

Fire events when components are updated. May be undefined. Must be defined before adding to gameObject.

Event Payload: