Setting View Direction

A 3D artist is free to model a character as he/she wishes.

For example, The artist can model a character with its default view-direction looking out the screen, as shown below:

Or can model the character with its default view-direction looking into the screen, as shown below:

The Untold Engine requires the character's default view direction to properly orient the entity.

Set the Default View Direction

To set the character's default view-direction, the Untold Engine provides the U4DEngine::U4DEntity::setEntityForwardVector() method. The method requires a vector correspoding to the view-direction.

For example, if a 3D model was modeled with its default view-direction looking out the screen. Then, per the Untold Engine's coordinate system, the default view-direction corresponds to the vector (0.0,0.0,-1.0).

The character's default view-direction would be set as follows:

U4DEngine::U4DVector3n viewDirectionVector(0,0,-1);
myAstronaut->setEntityForwardVector(viewDirectionVector);

View-in-Direction

The U4DEngine::U4DModel::viewInDirection() method orients a character in the direction specified by a vector.

Note: You must specify the default view-direction to properly use this method.

For example, the code below sets the view direction of the astronaut to vector location (-10.0,0.79,10.0):

U4DVector3n viewVector(-10.0,0.79,10.0);
myAstronaut->viewInDirection(viewVector);

The engine will orient the astronaut as follows:

As another example, the code below sets the view direction of the character to (-10.0,0.79,-10.0)

U4DVector3n viewVector(-10.0,0.79,-10.0);
myAstronaut->viewInDirection(viewVector);

The engine will orient the astronaut as shown below:

Last updated