Xors3d Engine
Entity movement

Functions

BBDECL void BBCALL xAlignToVector (Entity *entity, float x, float y, float z, int axis, float factor=1.0f)
 Aligns an entity axis to a vector.
BBDECL void BBCALL xMoveEntity (Entity *entity, float x, float y, float z, bool isGlobal=false)
 Moves an entity relative to its current position and orientation.
BBDECL void BBCALL xPointEntity (Entity *entity1, Entity *entity2, float roll=0.0f)
 Points one entity at another.
BBDECL void BBCALL xPositionEntity (Entity *entity, float x, float y, float z, bool isGlobal=false)
 Positions an entity at an absolute position in 3D space.
BBDECL void BBCALL xRotateEntity (Entity *entity, float x, float y, float z, bool isGlobal=false)
 Rotates an entity so that it is at an absolute orientation.
BBDECL void BBCALL xScaleEntity (Entity *entity, float x, float y, float z, bool isGlobal=false)
 Scales an entity so that it is of an absolute size.
BBDECL void BBCALL xTranslateEntity (Entity *entity, float x, float y, float z, bool isGlobal=false)
 Translates an entity relative to its current position and not its orientation.
BBDECL void BBCALL xTurnEntity (Entity *entity, float x, float y, float z, bool isGlobal=false)
 Turns an entity relative to its current orientation.

Function Documentation

BBDECL void BBCALL xScaleEntity ( Entity *  entity,
float  x,
float  y,
float  z,
bool  isGlobal = false 
)

Scales an entity so that it is of an absolute size.

Scale values of 1, 1, 1 are the default size when creating /loading entities. Scale values of 2, 2, 2 will double the size of an entity. Scale values of 0, 0, 0 will make an entity disappear. Scale values of less than 0, 0, 0 will invert an entity and make it bigger.

Parameters:
entityEntity handle
xx size of entity
yy size of entity
zz size of entity
isGlobalUnused
BBDECL void BBCALL xPositionEntity ( Entity *  entity,
float  x,
float  y,
float  z,
bool  isGlobal = false 
)

Positions an entity at an absolute position in 3D space.

Entities are positioned using an x, y, z coordinate system. x, y and z each have their own axis, and each axis has its own set of values. By specifying a value for each axis, you can position an entity anywhere in 3D space. 0, 0, 0 is the centre of 3D space, and if the camera is pointing in the default positive z direction, then positioning an entity with a z value of above 0 will make it appear in front of the camera, whereas a negative z value would see it disappear behind the camera. Changing the x value would see it moving sideways, and changing the y value would see it moving up/down. Of course, the direction in which entities appear to move is relative to the position and orientation of the camera.

Parameters:
entityEntity handle
xx coordinate that entity will be positioned at
yy coordinate that entity will be positioned at
zz coordinate that entity will be positioned at
isGlobalTrue if the position should be relative to 0, 0, 0 rather than a parent entity's position
BBDECL void BBCALL xMoveEntity ( Entity *  entity,
float  x,
float  y,
float  z,
bool  isGlobal = false 
)

Moves an entity relative to its current position and orientation.

What this means is that an entity will move in whatever direction it is facing. So for example if you have an game character is upright when first loaded and it remains upright (i.e. turns left or right only), then moving it by a z amount will always see it move forward or backward, moving it by a y amount will always see it move up or down, and moving it by an x amount will always see it strafe.

Parameters:
entityEntity handle
xx amount that entity will be moved by
yy amount that entity will be moved by
zz amount that entity will be moved by
isGlobalUnused
BBDECL void BBCALL xTranslateEntity ( Entity *  entity,
float  x,
float  y,
float  z,
bool  isGlobal = false 
)

Translates an entity relative to its current position and not its orientation.

What this means is that an entity will move in a certain direction despite where it may be facing. Imagine that you have a game character that you want to make jump in the air at the same time as doing a triple somersault. Translating the character by a positive y amount will mean the character will always travel directly up in their air, regardless of where it may be facing due to the somersault action.

Parameters:
entityEntity handle
xx amount that entity will be translated by
yy amount that entity will be translated by
zz amount that entity will be translated by
isGlobalUnused
BBDECL void BBCALL xRotateEntity ( Entity *  entity,
float  x,
float  y,
float  z,
bool  isGlobal = false 
)

Rotates an entity so that it is at an absolute orientation.

Parameters:
entityEntity handle
xAngle in degrees of pitch rotation
yAngle in degrees of yaw rotation
zAngle in degrees of roll rotation
isGlobalTrue if the angle rotated should be relative to 0, 0, 0 rather than a parent entity's orientation
BBDECL void BBCALL xTurnEntity ( Entity *  entity,
float  x,
float  y,
float  z,
bool  isGlobal = false 
)

Turns an entity relative to its current orientation.

Parameters:
entityEntity handle
xAngle in degrees that entity will be pitched
yAngle in degrees that entity will be yawed
zAngle in degrees that entity will be rolled
isGlobalTrue to turn in global coordinate system, false - for local
BBDECL void BBCALL xPointEntity ( Entity *  entity1,
Entity *  entity2,
float  roll = 0.0f 
)

Points one entity at another.

The roll parameter allows you to specify a roll angle as pointing an entity only sets pitch and yaw angles. If you wish for an entity to point at a certain position rather than another entity, simply create a pivot entity at your desired position, point the entity at this and then free the pivot.

Parameters:
entity1First entity handle
entity2Second entity handle
rollRoll angle of entity
BBDECL void BBCALL xAlignToVector ( Entity *  entity,
float  x,
float  y,
float  z,
int  axis,
float  factor = 1.0f 
)

Aligns an entity axis to a vector.

Parameters:
entityEntity handle
xVector x
yVector y
zVector z
axisAxis of entity that will be aligned to vector. See 'Axis' for more information
factorRate at which entity is aligned from current orientation to vector orientation. Should be in the range [0.0; 1.0], 0.0 for smooth transition and 1.0 for 'snap' transition. Default is 1.0