GetPersonAngle
From Spheriki
Gets the rotation angle of the person in radians.
Contents |
[edit]
Usage
number GetPersonAngle(name);
- name String. The name of the person to check the angle of.
- number is returned, containing the angle of the person.
[edit]
Example
Use the Sphere IDE or a similar application to place this script inside the render and update scripts of a map respectively.
// Render script
GetSystemFont().drawText(10, 10, "Angle = " + GetPersonAngle("person_name_here"));
// Update script
SetPersonAngle("person_name_here", GetPersonAngle("person_name_here") + 0.01);
Substituting person_name_here for a person name will cause that person to rotate anticlockwise continuously while the map engine is running. The current angle will be displayed in the top-left corner.
[edit]
Notes
- Like all Sphere functions that work with angles, the angle returned by this function is in the form of radians. To convert between radians and degrees, use Math.js (system script), or write your own simple routines.
- Angles are measured as zero radians pointing to the right, and then increasing anticlockwise.
[edit]

