Base class for all components that can be attached to an Actor. Provides transform management (position, size, rotation) relative to its owner. Components can override lifecycle methods (OnStart, Update, OnEnd).
Component(Actor* owner, int updateOder);
Default constructor of a component. It needs an owner and an update order (by default equal to 0)
virtual void OnStart();
Called once when the component is initialized.
virtual void Update();
Called every frame.
virtual void OnEnd();
Called when the component is destroyed.
void SetRelativePosition(Vector3D pPosition);
Sets the relative location of the component regarding the owner location.
void SetRelativeSize(Vector3D pSize);
Sets the relative size of the component regarding the owner size.
void SetRelativeRotation(Quaternion pRotation);
Sets the relative rotation of the component regarding the owner rotation.
void RelativeRotateX(float pAngle);
Relative rotates around X axis.
void RelativeRotateY(float pAngle);
Relative rotates around Y axis.
void RelativeRotateZ(float pAngle);
Relative rotates around Z axis.
virtual Matrix4DRow GetWorldTransform();
Returns the world transform of the component.
Matrix4DRow GetRelativeTransform() const;
Returns the relative transform of the component.
Vector3D RelativeRight() const
Returns the relative right vector of the component.
Vector3D RelativeForward() const
Returns the relative forward vector of the component.
Vector3D RelativeUp() const
Returns the relative up vector of the component.
Vector3D GetRelativePosition() const
Returns the relative location of the component.
Vector3D GetRelativeSize() const
Returns the relative size of the component.
Vector3D GetWorldPosition();
Returns the world position of the component.
Actor* GetOwner();
Returns the owner of the component.