Pencil Code Reference > direction

 

direction angle to an object

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

t.direction(p)

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

t.direction()

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.