Skip to content

Modifying 3D Objects

Coela Can't! edited this page Aug 20, 2021 · 3 revisions

Object3D Modifications

Object3Ds can be modified in several ways, primarily their transform structure can be modified to set its position, rotation, and scale. Object3Ds can also be passed into external classes and their vertices can be directly modified to change their shape - this can be seen with the ObjectDeformer.

// Objects visibility can be enabled and disabled at any point before rasterizing to change its visibility to the camera(s)
object3D.Enable();

// Objects can be moved to a coordinate or translated by a vector
object3D.GetTransform()->SetPosition(Vector3D(35.0f, 20.0f, 600.0f));

// Objects can be rotated with by any rotation object (quaternion is preferred) and about any coordinate or center
object3D.GetTransform()->SetRotation(Vector3D(20.0f, 0.0f, 20.0f));
object3D.GetTransform()->SetRotation(Quaternion(1.0f, 0.0f, 0.0f, 0.0f));

// Objects can be scaled by origin, center, and at a point
object3D.GetTransform()->SetScale(Vector3D(1.0f, 0.8f, 1.2f));

// Once the parameters of the transform are set, the object needs to update its state based on the updated transform
object3D.UpdateTransform();