UnitGetPosition
point CameraGetTarget(int player);
Position watched by the player.
Parameters
- int player
Player that is watching. Also works for AI.
Return value
point - Position watched by the player. To get it you draw a ray from the center of the screen (intersection of diagonals) and see where it hits the ground.
Examples
- Example: IsPlayerWatching
// Tell if the player camera can see the unit bool IsPlayerWatching(int player, unit u) { point cameraPos = CameraGetTarget(player); point unitPos = UnitGetPosition(u); return DistanceBetweenPoints(cameraPos, unitPos) < 20; }