Add methods to the camera to roll the view.
Add methods to the camera to roll the view.
Would it be much complex to add get/set roll methods for the camera? The idea is to have a method to avoid gimbal locks by removing the need to use a get/set up vector, it would keep the camera oriented by using the view vector, and a rotation and if we wanted to change the up vector, we would roll the camera, This way, the up vector could be on every moment, perpendicular to the view vector, independently of its orientation, and there would be, initially, no posibility of gimbal locks, the up vector could be calculated from a rotation of this setup, and could be accessed the same. The drawback would be that we shouldn't allow setting the up vector as it is right now, so this might be safeguarded by a flag which disabled the updating of the up vector when the roll camera was in effect. But internally, the view matrix could still make use of it, as if nothing had happened, as the up vector is still obtainable. It would make the camera more robust.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: Add methods to the camera to roll the view.
Good idea in theory. No idea how much work (I have to admit in my projects I tend to start by doing stuff like copying Irrlicht camera-code into my own class and then just working on whatever my projects need as Irrlicht camera never does exactly what I need).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Add methods to the camera to roll the view.
the question is, how would you find that up vector perpendicular to the view vector?
P.S. view vector + roll = quaternion
P.P.S I intend to get rid of getRotation setRotation in Euler Angles in all of IrrlichtBAW except for quaternion::set*
P.S. view vector + roll = quaternion
P.P.S I intend to get rid of getRotation setRotation in Euler Angles in all of IrrlichtBAW except for quaternion::set*
Re: Add methods to the camera to roll the view.
Yeah - kinda a problem. As you don't control camera only with rotations but also can set it directly to some view-target.
@Mel: Assume you have view 0,0,1 and up 0,1,0 per default. Now you want view 0,0,-1 to look in the other direction. If you rotate around y then up would still be 0,1,0, but if you rotate around x then up would be 0,-1,0 now. And if you don't know rotation direction you can't really say what up will be.
@Mel: Assume you have view 0,0,1 and up 0,1,0 per default. Now you want view 0,0,-1 to look in the other direction. If you rotate around y then up would still be 0,1,0, but if you rotate around x then up would be 0,-1,0 now. And if you don't know rotation direction you can't really say what up will be.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Add methods to the camera to roll the view.
its possible to design a system that doesn't suffer from gimbal lock, but it would suffer from utter unusability.
Take for example reprojected viewspace delta movement (move in the great circle direction corresponding to your delta mouse movement in the plane tangent to a unit sphere with a normal colinear with your view direction inscribed into the unit circle)
Example in normal right handed coord system, not retarded DirectX
Start facing Z+
You move the mouse up to move 90 degrees -> you look straight up Y+ and your right vector is X+ and your up vector Z-
You move mouse right to move 90 degrees -> you look along X+, and your up vector is Z- and your right vector is Y-
You're on your side!
Essentially such systems gently caress you up completely because they give you 6DOF and no notion of the downward direction (gravity) and are impossible to control reliably, diagonal mouse movements move you in weird spirals.
People expect Y to be up/down and X to be left/right
Take for example reprojected viewspace delta movement (move in the great circle direction corresponding to your delta mouse movement in the plane tangent to a unit sphere with a normal colinear with your view direction inscribed into the unit circle)
Example in normal right handed coord system, not retarded DirectX
Start facing Z+
You move the mouse up to move 90 degrees -> you look straight up Y+ and your right vector is X+ and your up vector Z-
You move mouse right to move 90 degrees -> you look along X+, and your up vector is Z- and your right vector is Y-
You're on your side!
Essentially such systems gently caress you up completely because they give you 6DOF and no notion of the downward direction (gravity) and are impossible to control reliably, diagonal mouse movements move you in weird spirals.
People expect Y to be up/down and X to be left/right
Re: Add methods to the camera to roll the view.
I don't have the details exactly, but i came up with this idea after messing with 3DSMAX, and seeing how, indeed, a view vector/roll angle are very close in definition to a quaternion defined by an axis and an angle, then again, 3DSMAX never inverts the camera orientation (i.e. never goes "upside down", unless rolled) i thought it could be a good idea to discuss on. I found, later, this: http://tuttlem.github.io/2013/12/30/a-c ... -in-c.html I would have to implement something to test, but indeed, it seems the first step is to begin from a "safe" start, and work from there on.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt