Rotation

How rotations are applied to entities, axis conventions, and helper methods in Ursina Engine

Rotation

Rotations are specified in degrees around each axis. The default sign convention is:

  • X and Y axes rotate clockwise when viewed from outside
  • Z axis rotates counter-clockwise (so 2D rotation appears clockwise)

This is controlled by:

Entity.rotation_directions = (-1, -1, 1)
           _______
          /
          \->
    __
   /  \     y
   v  |     |
      |  z  |                __
          \ |               /  \
           \|               v   |
            *---------- x       |

Common methods

  • Absolute set:
    entity.rotation = Vec3(rx, ry, rz)
  • Continuous rotate:
    entity.rotate(amount)
  • Face a point in 3D:
    entity.look_at(target_position)
  • Face a point in 2D:
    entity.look_at_2d(target_position)
  • Direct quaternion access:
    q = entity.quaternion
    entity.quaternion = new_q