SC2Mapster.com Wiki

UnitGetFacing

fixed UnitGetFacing(unit u);

Facing angle of the unit in degrees.

Parameters

unit u

Unit to get the facing of.

Return value

fixed - Angle in degrees. Between -180° (excluded) and 180°.

Examples

Example: Sample Usage
unit u = // Fill ... ;
int player = // Fill ...;

// Point 5 ranges units in front of the unit
point targetPoint = PointWithOffsetPolar(UnitGetPosition(u),
                                          5, UnitGetFacing(u));

// Order to move to the wanted point
order ord = AICreateOrder(player, "move", 0);
OrderSetTargetPoint(ord, targetPoint );

// Tell the unit to go there
AICast(u, ord, c_noMarker, true);
  • angles.jpg

You must login to post a comment. Don't have an account? Register to get one!

  • 1 comment
  • Avatar of ShaZe88 ShaZe88 Aug 04, 2010 at 19:51 UTC - 0 likes

    I can't get this function to work properly, I am currently using :

    int angle = UnitGetFacing(Unit); 
    return angle;
    

    Where unit is the unit I want to get the angle from and angle is the integer returned from the function but it keep giving me syntax error. I also tried different variation such as :

    unit u = Unit;             (or any unit name)
    int angle = UnitGetFacing(u); 
    return angle;
    
  • 1 comment

Facts

Date created
Mar 13, 2010
Last updated
Mar 19, 2010