SetFacing

From NWN Lexicon



Contents

[edit] SetFacing(float)

Sets the object to face a certain direction.

void SetFacing(
    float fDirection
);

[edit] Parameters

fDirection

A floating point number that represents the direction to face. See description for additional details.


[edit] 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



[edit] Remarks

Note that GetFacing will correctly return the facing to the nearest degree from 1.62.


[edit] Known Bugs

There are issues with setting the facing of sitting creatures.


[edit] Version

1.22

[edit] 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);
}

[edit] See Also

functions: 

SetFacingPoint

constants: 

DIRECTION_* Constants



 author: Tom Cassiotis, editor: Jasperre
 

Personal tools
Categories