Transform
in package
Table of Contents
Properties
- $isDirty : bool
- Flag indicating whether the matrix is dirty and needs to be recalculated.
- $orientation : Quat
- Current orientation in local space.
- $parent : int|null
- Parent entity id.
- $position : Vec3
- Current position in local space.
- $scale : Vec3
- Current scale in local space.
- $matrix : Mat4
- Internal matrix representation.
- $previous : Transform|null
- Prvious transform Can story a copy of the current transform before it was modified.
Methods
- __clone() : mixed
- __construct() : mixed
- Constructor
- dirBackward() : Vec3
- Returns the backward direction of the transform
- dirDown() : Vec3
- Returns the down direction of the transform
- dirForward() : Vec3
- Returns the forward direction of the transform
- dirLeft() : Vec3
- Returns the left direction of the transform
- dirRight() : Vec3
- Returns the right direction of the transform
- dirUp() : Vec3
- Returns the up direction of the transform
- getInterpolatedLocalMatrix() : Mat4
- Returns a interpolated matrix between the previous and current transform.
- getInterpolatedOrientation() : Quat
- Returns the interpolated orientation between the previous and current transform.
- getInterpolatedPosition() : Vec3
- Returns the interpolated position between the previous and current transform.
- getInterpolatedScale() : Vec3
- Returns the interpolated scale between the previous and current transform.
- getLocalEulerAngles() : Vec3
- Retruns the orientation as euler angles.
- getLocalMatrix() : Mat4
- Returns the local matrix.
- getParent() : Transform|null
- Returns the parent Transform component.
- getWorldEulerAngles() : Vec3
- Returns the orientation as euler angles in world space.
- getWorldMatrix() : Mat4
- Returns the world matrix.
- getWorldOrientation() : Quat
- Returns the orientation in world space.
- getWorldPosition() : Vec3
- Returns the position in world space.
- getWorldScale() : Vec3
- Returns the scale in world space.
- lookAt() : void
- Look at a point in world space.
- lookIn() : void
- Look in a direction in world space.
- markDirty() : void
- Flags the internal matrix as dirty.
- moveBackward() : void
- Translates backward in local space.
- moveDown() : void
- Translates down in local space.
- moveForward() : void
- Translates forward in local space.
- moveLeft() : void
- Translates left in local space.
- moveRight() : void
- Translates right in local space.
- moveUp() : void
- Translates up in local space.
- resetPrevious() : void
- Resets the previous transform.
- setOrientation() : void
- Sets the orientation of the transform.
- setParent() : void
- Sets the parent entity id.
- setPosition() : void
- Sets the position of the transform.
- setScale() : void
- Sets the scale of the transform.
- storePrevious() : void
- Calling this function will store a copy of the current transform as the previous transform.
- worldBackward() : Vec3
- Returns a new Vec3 with a vector pointing backward in the world.
- worldDown() : Vec3
- Returns a new Vec3 with a vector pointing down in the world.
- worldForward() : Vec3
- Returns a new Vec3 with a vector pointing forward in the world.
- worldLeft() : Vec3
- Returns a new Vec3 with a vector pointing left in the world.
- worldRight() : Vec3
- Returns a new Vec3 with a vector pointing right in the world.
- worldUp() : Vec3
- Returns a new Vec3 with a vector pointing up in the world.
Properties
$isDirty
Flag indicating whether the matrix is dirty and needs to be recalculated.
public
bool
$isDirty
= true
$orientation
Current orientation in local space.
public
Quat
$orientation
$parent
Parent entity id.
public
int|null
$parent
= null
$position
Current position in local space.
public
Vec3
$position
$scale
Current scale in local space.
public
Vec3
$scale
$matrix
Internal matrix representation.
private
Mat4
$matrix
$previous
Prvious transform Can story a copy of the current transform before it was modified.
private
Transform|null
$previous
= null
This can be used for interpolation of the transformation between frames.
Methods
__clone()
public
__clone() : mixed
__construct()
Constructor
public
__construct() : mixed
dirBackward()
Returns the backward direction of the transform
public
dirBackward() : Vec3
Return values
Vec3dirDown()
Returns the down direction of the transform
public
dirDown() : Vec3
Return values
Vec3dirForward()
Returns the forward direction of the transform
public
dirForward() : Vec3
Return values
Vec3dirLeft()
Returns the left direction of the transform
public
dirLeft() : Vec3
Return values
Vec3dirRight()
Returns the right direction of the transform
public
dirRight() : Vec3
Return values
Vec3dirUp()
Returns the up direction of the transform
public
dirUp() : Vec3
Return values
Vec3getInterpolatedLocalMatrix()
Returns a interpolated matrix between the previous and current transform.
public
getInterpolatedLocalMatrix(float $alpha) : Mat4
Parameters
- $alpha : float
Return values
Mat4getInterpolatedOrientation()
Returns the interpolated orientation between the previous and current transform.
public
getInterpolatedOrientation(float $alpha) : Quat
Parameters
- $alpha : float
Return values
QuatgetInterpolatedPosition()
Returns the interpolated position between the previous and current transform.
public
getInterpolatedPosition(float $alpha) : Vec3
Parameters
- $alpha : float
Return values
Vec3getInterpolatedScale()
Returns the interpolated scale between the previous and current transform.
public
getInterpolatedScale(float $alpha) : Vec3
Parameters
- $alpha : float
Return values
Vec3getLocalEulerAngles()
Retruns the orientation as euler angles.
public
getLocalEulerAngles() : Vec3
Return values
Vec3getLocalMatrix()
Returns the local matrix.
public
getLocalMatrix() : Mat4
Return values
Mat4getParent()
Returns the parent Transform component.
public
getParent(EntitiesInterface $entities) : Transform|null
Parameters
- $entities : EntitiesInterface
-
The entity registry the parent entity is stored in.
Return values
Transform|nullgetWorldEulerAngles()
Returns the orientation as euler angles in world space.
public
getWorldEulerAngles(EntitiesInterface $entities) : Vec3
Parameters
- $entities : EntitiesInterface
-
The entity registry the parent entity is stored in.
Return values
Vec3getWorldMatrix()
Returns the world matrix.
public
getWorldMatrix(EntitiesInterface $entities) : Mat4
Parameters
- $entities : EntitiesInterface
-
The entity registry the parent entity is stored in.
Return values
Mat4getWorldOrientation()
Returns the orientation in world space.
public
getWorldOrientation(EntitiesInterface $entities) : Quat
Parameters
- $entities : EntitiesInterface
-
The entity registry the parent entity is stored in.
Return values
QuatgetWorldPosition()
Returns the position in world space.
public
getWorldPosition(EntitiesInterface $entities) : Vec3
Parameters
- $entities : EntitiesInterface
-
The entity registry the parent entity is stored in.
Return values
Vec3getWorldScale()
Returns the scale in world space.
public
getWorldScale(EntitiesInterface $entities) : Vec3
Parameters
- $entities : EntitiesInterface
-
The entity registry the parent entity is stored in.
Return values
Vec3lookAt()
Look at a point in world space.
public
lookAt(Vec3 $point) : void
Parameters
- $point : Vec3
lookIn()
Look in a direction in world space.
public
lookIn(Vec3 $direction) : void
Parameters
- $direction : Vec3
markDirty()
Flags the internal matrix as dirty.
public
markDirty() : void
When you modify the position, orientation or scale of the transform manually You have to call this method to make sure the internal matrix is recalculated.
moveBackward()
Translates backward in local space.
public
moveBackward(float $distance) : void
Parameters
- $distance : float
moveDown()
Translates down in local space.
public
moveDown(float $distance) : void
Parameters
- $distance : float
moveForward()
Translates forward in local space.
public
moveForward(float $distance) : void
Parameters
- $distance : float
moveLeft()
Translates left in local space.
public
moveLeft(float $distance) : void
Parameters
- $distance : float
moveRight()
Translates right in local space.
public
moveRight(float $distance) : void
Parameters
- $distance : float
moveUp()
Translates up in local space.
public
moveUp(float $distance) : void
Parameters
- $distance : float
resetPrevious()
Resets the previous transform.
public
resetPrevious() : void
setOrientation()
Sets the orientation of the transform.
public
setOrientation(Quat $orientation) : void
Note: This will mark the internal matrix as dirty.
Parameters
- $orientation : Quat
setParent()
Sets the parent entity id.
public
setParent(EntitiesInterface $entities, int $parent) : void
Parameters
- $entities : EntitiesInterface
-
The entity registry the parent entity is stored in.
- $parent : int
setPosition()
Sets the position of the transform.
public
setPosition(Vec3 $position) : void
Note: This will mark the internal matrix as dirty.
Parameters
- $position : Vec3
setScale()
Sets the scale of the transform.
public
setScale(Vec3 $scale) : void
Note: This will mark the internal matrix as dirty.
Parameters
- $scale : Vec3
storePrevious()
Calling this function will store a copy of the current transform as the previous transform.
public
storePrevious() : void
worldBackward()
Returns a new Vec3 with a vector pointing backward in the world.
public
static worldBackward() : Vec3
Return values
Vec3worldDown()
Returns a new Vec3 with a vector pointing down in the world.
public
static worldDown() : Vec3
Return values
Vec3worldForward()
Returns a new Vec3 with a vector pointing forward in the world.
public
static worldForward() : Vec3
Return values
Vec3worldLeft()
Returns a new Vec3 with a vector pointing left in the world.
public
static worldLeft() : Vec3
Return values
Vec3worldRight()
Returns a new Vec3 with a vector pointing right in the world.
public
static worldRight() : Vec3
Return values
Vec3worldUp()
Returns a new Vec3 with a vector pointing up in the world.
public
static worldUp() : Vec3