Wasabi
Public Member Functions | List of all members
WOrientation Class Reference

#include <WOrientation.hpp>

Inheritance diagram for WOrientation:
WBone WCamera WInstance WLight WObject WParticles WRigidBody WTerrain

Public Member Functions

void SetPosition (float x, float y, float z)
 
void SetPosition (const WVector3 pos)
 
void Point (float x, float y, float z)
 
void Point (WVector3 target)
 
void SetAngle (WQuaternion quat)
 
void SetToRotation (const WOrientation *const device)
 
void SetULRVectors (WVector3 up, WVector3 look, WVector3 right)
 
void SetToTransformation (WMatrix mtx)
 
void Yaw (float angle)
 
void Roll (float angle)
 
void Pitch (float angle)
 
void Move (float units)
 
void Strafe (float units)
 
void Fly (float units)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
WVector3 GetPosition () const
 
float GetAngleX () const
 
float GetAngleY () const
 
float GetAngleZ () const
 
WQuaternion GetRotation () const
 
WVector3 GetUVector () const
 
WVector3 GetLVector () const
 
WVector3 GetRVector () const
 
virtual void SetBindingMatrix (WMatrix mtx)
 
void RemoveBinding ()
 
WMatrix GetBindingMatrix () const
 
bool IsBound () const
 
virtual void OnStateChange (STATE_CHANGE_TYPE type)
 
WMatrix ComputeTransformation () const
 
WMatrix ComputeInverseTransformation () const
 

Detailed Description

A WOrientation represents a hypothetical object in 3D space. To represent position, the class uses a 3D vector. To represent rotation, the class uses a set of 3 vectors:

Member Function Documentation

◆ ComputeInverseTransformation()

WMatrix WOrientation::ComputeInverseTransformation ( ) const

This function recomputes the transformation matrix for this orientation. Most objects inheriting from WOrientation have their own GetWorldMatrix functions that are more efficient to use (since they cache the matrix).

Returns
returns a newly computed matrix corresponding to this orientation

◆ ComputeTransformation()

WMatrix WOrientation::ComputeTransformation ( ) const

This function recomputes the transformation matrix for this orientation. Most objects inheriting from WOrientation have their own GetWorldMatrix functions that are more efficient to use (since they cache the matrix).

Returns
returns a newly computed matrix corresponding to this orientation

◆ Fly()

void WOrientation::Fly ( float  units)

Moves the entity up. This will result in OnOrientationChange(CHANGE_MOTION) to be called.

Parameters
unitsUnits to move by

◆ GetAngleX()

float WOrientation::GetAngleX ( ) const

Gets the angle between the look vector (projected onto the yz plane) and the world z axis (0, 0, 1).

Returns
X angle of the entity

◆ GetAngleY()

float WOrientation::GetAngleY ( ) const

Gets the angle between the look vector (projected onto the xz plane) and the world z axis (0, 0, 1).

Returns
Y angle of the entity

◆ GetAngleZ()

float WOrientation::GetAngleZ ( ) const

Gets the angle between the up vector (projected onto the xy plane) and the world y axis (0, 1, 0).

Returns
Z angle of the entity

◆ GetBindingMatrix()

WMatrix WOrientation::GetBindingMatrix ( ) const

Retrieves the binding matrix. This can be used to multiply a world matrix corresponding to this WOrientation to produce the effect of being "bound" or "stuck" to something else as it moves.

Returns
The binding matrix

◆ GetLVector()

WVector3 WOrientation::GetLVector ( ) const

Retrieves the look vector of the entity.

Returns
The look vector of the entity

◆ GetPosition()

WVector3 WOrientation::GetPosition ( ) const

Retrieves the position of the entity.

Returns
Position of the entity in 3D space

◆ GetPositionX()

float WOrientation::GetPositionX ( ) const

Retrieves the X position of the entity.

Returns
The X position of the entity

◆ GetPositionY()

float WOrientation::GetPositionY ( ) const

Retrieves the Y position of the entity.

Returns
The Y position of the entity

◆ GetPositionZ()

float WOrientation::GetPositionZ ( ) const

Retrieves the Z position of the entity.

Returns
The Z position of the entity

◆ GetRotation()

WQuaternion WOrientation::GetRotation ( ) const
Returns
A quaternion representing the rotation of the entity

◆ GetRVector()

WVector3 WOrientation::GetRVector ( ) const

Retrieves the right vector of the entity.

Returns
The right vector of the entity

◆ GetUVector()

WVector3 WOrientation::GetUVector ( ) const

Retrieves the up vector of the entity.

Returns
The up vector of the entity

◆ IsBound()

bool WOrientation::IsBound ( ) const

Checks whether or not the entity should be bound to a matrix or not.

Returns
true if the entity is bound, false otherwise

◆ Move()

void WOrientation::Move ( float  units)

Moves the entity forward. This will result in OnOrientationChange(CHANGE_MOTION) to be called.

Parameters
unitsUnits to move by

◆ OnStateChange()

virtual void WOrientation::OnStateChange ( STATE_CHANGE_TYPE  type)
virtual

A callback called by this class when the entity changes its position or orientation.

Parameters
typeOrientation change type

Reimplemented in WRigidBody, WParticles, WObject, WLight, WTerrain, WBulletRigidBody, WCamera, WRigidBody, WBone, and WInstance.

◆ Pitch()

void WOrientation::Pitch ( float  angle)

Performs a rotation around the right axis of this entity. This will result in OnOrientationChange(CHANGE_ROTATION) to be called.

Parameters
angleAngle of rotation, in degrees

◆ Point() [1/2]

void WOrientation::Point ( float  x,
float  y,
float  z 
)

Sets the entity's orientation to point towards a 3D point. This will result in calling OnStateChange(CHANGE_ROTATION).

Parameters
xx coordinate of the point to look at
yy coordinate of the point to look at
zz coordinate of the point to look at

◆ Point() [2/2]

void WOrientation::Point ( WVector3  target)

Sets the entity's orientation to point towards a 3D point. This will result in calling OnStateChange(CHANGE_ROTATION).

Parameters
targetcoordinate of the point to look at

◆ RemoveBinding()

void WOrientation::RemoveBinding ( )

Removes or disables the current binding

◆ Roll()

void WOrientation::Roll ( float  angle)

Performs a rotation around the look axis of this entity. This will result in OnOrientationChange(CHANGE_ROTATION) to be called.

Parameters
angleAngle of rotation, in degrees

◆ SetAngle()

void WOrientation::SetAngle ( WQuaternion  quat)

Sets the rotation of the entity to match that of a quaternion. This will result in calling OnStateChange(CHANGE_ROTATION).

Parameters
quatQuaternion to match

◆ SetBindingMatrix()

virtual void WOrientation::SetBindingMatrix ( WMatrix  mtx)
virtual

Binds this entity to the matrix provided. A WOrientation that is bound to a matrix may choose to alter the final matrix it produces (multiply it by the binding matrix) to achieve the effect of being "bound" or "stuck" to something else as it moves.

Parameters
mtxMatrix to bind to

◆ SetPosition() [1/2]

void WOrientation::SetPosition ( const WVector3  pos)

Sets the position of this entity.

Parameters
posNew position

◆ SetPosition() [2/2]

void WOrientation::SetPosition ( float  x,
float  y,
float  z 
)

Sets the position of this entity. This will result in calling OnStateChange(CHANGE_MOTION).

Parameters
xNew x position
yNew y position
zNew z position

◆ SetToRotation()

void WOrientation::SetToRotation ( const WOrientation *const  device)

Sets the orientation of this entity to match that of another. This will result in calling OnStateChange(CHANGE_ROTATION).

Parameters
deviceThe orientation to match

◆ SetToTransformation()

void WOrientation::SetToTransformation ( WMatrix  mtx)

Sets the orientation & position to match that of a given transformation matrix.

Parameters
mtxTransformation matrix

◆ SetULRVectors()

void WOrientation::SetULRVectors ( WVector3  up,
WVector3  look,
WVector3  right 
)

Explicitly sets the up, look and right vectors. This will result in calling OnStateChange(CHANGE_ROTATION).

Parameters
upNew up vector
lookNew look vector
rightNew right vector

◆ Strafe()

void WOrientation::Strafe ( float  units)

Moves the entity to the right. This will result in OnOrientationChange(CHANGE_MOTION) to be called.

Parameters
unitsUnits to move by

◆ Yaw()

void WOrientation::Yaw ( float  angle)

Performs a rotation around the up axis of this entity. This will result in OnOrientationChange(CHANGE_ROTATION) to be called.

Parameters
angleAngle of rotation, in degrees

The documentation for this class was generated from the following file: