SetFacing(float)
Sets the object to face a certain direction.
void SetFacing( float fDirection );
Parameters
fDirection
A floating point number that represents the direction to face. See description for additional details.
Description
Causes the caller of this function to face fDirection.
There are some predefined constants for a direction:
DIRECTION_EAST = 0.0
DIRECTION_NORTH = 90.0
DIRECTION_WEST = 180.0
DIRECTION_SOUTH = 270.0
Remarks
Note that GetFacing will correctly return the facing to the nearest degree from 1.62.
Known Bugs
There are issues with setting the facing of sitting creatures.
Version
1.22
Example
// Used in the OnSpawn of a creature to set // their facing to a random direction. main() { // Get a random direction from 0 to 360 float fDirection = IntToFloat(Random(361)); SetFacing(fDirection); }
See Also
functions: | MoveToNewLocation | SetFacingPoint |
categories: | Movement Functions |
constants: | DIRECTION_* Constants |
author: Tom Cassiotis, editor: Jasperre