Adds the ability to control the 3rd rotational axis (roll), in addition to yaw/tilt (alpha/beta). Adding the 3rd axis can make things weird, in that it changes what the camera treats as 'up' (the up vector). And once the up vector has changed, it's practically impossible to reset it back to default with just the camera controls. You have to reset it programmatically. For this reason, roll is disabled by default in both mouse/kb controls and touch controls.
Also, the concept of being 'upside down' makes no sense when you can change what 'up' means, and so allow_upside_down should typically be set to true when enabling roll or changing the up vector.
The roll control is implemented by introducing a 'base transform' upon which all other transformations are applied. By default, when roll is disabled, this base transform is identical to the world transform, i.e. Transform::IDENTITY. Changing the rotation of the base transform changes the 'up' vector. Changing the translation of it is not supported but theoretically it will effectively just change what 'zero pan' means, so isn't that useful. (Transform is used instead of a rotation like Quat or Mat3 because it provides useful methods.)
This PR also introduces a touch_enabled property which can be used to disable touch controls entirely (it's true by default). Disabling this may result in slightly better performance, but I haven't tested and I suspect the difference would be negligible in most cases.
Add key_roll_left and key_roll_right properties, defaulting to None (i.e. roll disabled)
Add touch_enabled and touch_roll_enabled, defaulting to true and false respectively
Update touch example to enable roll
Update advanced example to enable roll
Add alternate_up_vector example
Replace apply_limits util function with trait (more rusty!?)
Various additions/improvements to comments/docs and minor code cleanup
closes #41
Adds the ability to control the 3rd rotational axis (roll), in addition to yaw/tilt (alpha/beta). Adding the 3rd axis can make things weird, in that it changes what the camera treats as 'up' (the up vector). And once the up vector has changed, it's practically impossible to reset it back to default with just the camera controls. You have to reset it programmatically. For this reason, roll is disabled by default in both mouse/kb controls and touch controls. Also, the concept of being 'upside down' makes no sense when you can change what 'up' means, and so
allow_upside_down
should typically be set totrue
when enabling roll or changing the up vector.The roll control is implemented by introducing a 'base transform' upon which all other transformations are applied. By default, when roll is disabled, this base transform is identical to the world transform, i.e.
Transform::IDENTITY
. Changing the rotation of the base transform changes the 'up' vector. Changing the translation of it is not supported but theoretically it will effectively just change what 'zero pan' means, so isn't that useful. (Transform is used instead of a rotation like Quat or Mat3 because it provides useful methods.)This PR also introduces a
touch_enabled
property which can be used to disable touch controls entirely (it's true by default). Disabling this may result in slightly better performance, but I haven't tested and I suspect the difference would be negligible in most cases.key_roll_left
andkey_roll_right
properties, defaulting toNone
(i.e. roll disabled)touch_enabled
andtouch_roll_enabled
, defaulting totrue
andfalse
respectivelyalternate_up_vector
exampleapply_limits
util function with trait (more rusty!?)Roll with keyboard controls:
https://github.com/Plonq/bevy_panorbit_camera/assets/7709415/b939f4e5-8e71-4b38-a179-8a5ef35ec2f5
Roll with touch controls:
https://github.com/Plonq/bevy_panorbit_camera/assets/7709415/9ebccc96-26c5-4a47-86d7-dd4f3c71ed34