The children of this object
A matrix representing the translation, rotation and scale of this object.
Whether to automatically calculate the object matrix each time updateWorldMatrix is called. Convenient, but potentially costly.
Optional
parentThe parent of this object.
Object position
Object rotation, expressed as a quaternion
Object rotation, expressed as a 3D Euler rotation
Object scale
The up unit vector
Whether this objec is visible or not. This will stop the renderer from trying to render this object
The world matrix represents the function of all ancestor matrices and the matrix of this object
A boolean indicating whether the world matrix requires updating.
Adds a child object to this and indicates whether to notify the child
The object to add as a child of this one
Whether to set the parent of the indicated child to this
Makes the object look at a particular target, useful for cameras
The point to look at
Look away from, if true
Remove a child from this object.
The child to remove
Whether to notify the child of the removal
Sets the parent of this object and indicates whether to set a child relationship on the parent.
The parent object to use
Whether to set the full parent-child relationsjip
Update the fill world matrix of this object basically used for recursively looping down the hierarchy when a change in the RTS matrix is changed on this.
Optional
force: booleanEven is this is not set to world matrix update, force it. Used when looping down past the first iteration.
UpdateRotation should be called whenever a change to the quaternion variable is made. This will update the rotation in response to the change in the quaternion. For example:
const Box = new Mesh(gl, { geometry: BoxGeo, program });
Box.quaternion = Quat.fromAxisAngle(new Vec3(1,0,0), Math.PI*-.25);
Box.updateQuaternion();
console.log(Box.rotation) // {_x: 0.7853981633974483, _y: 0, _z: 0}
UpdateRotation should be called whenever a change to the rotation variable is made. This will update the quaternion in response to the change in the rotation. For example:
const Box = new Mesh(gl, { geometry: BoxGeo, program });
Box.rotation.x = Math.PI*.25;
Box.updateRotation();
console.log(Box.quaternion) // {_x: 0.3826834323650898, _y: 0, _z: 0, _w: 0.9238795325112867}
Class representing an object. This provides basic transformations for sub-objects and shouldn't be instanciated directly.