A handheld device comprises a three-axis accelerometer (506) for determining an acceleration of the device and outputting an acceleration output associated therewith; a plurality of rotational sensors (502, 504) for determining rotation of the device about a respective plurality of axes and outputting a respective plurality of rotational outputs associated therewith; and a processing unit for: determining movement of the device in the first frame of reference based on the acceleration output and the plurality of rotational outputs; determining an orientation of the device in the first frame of reference based on the angular velocities of the device in the first frame of reference and the acceleration output corresponding to the acceleration of the device due to gravity in the first frame of reference; and generating a rotation quaternion for use with rotating the determined movement from the first frame of reference to a second frame of reference.