Pencil Code Reference > direction


direction angle to an object

direction returns the angle to an object from the starting position (facing straight up).


However, when given no arguments it returns the current facing direction of an object.


This can be used to get the relative facing direction for use in lt and rt.

rt direction(p)-direction()

The following graphic utilizes these concepts to give a visual of the angles used by direction.