Currently, I have a mechanism to orient the view to standard orientation by modifying the model view matrix.
I would like to enhance the user experience by providing a smooth animation that will take the user from the current view orientation to the standard view orientation with a smooth transition -> (constant rate of change of direction).
The transition should ideally take less than 500 milliseconds.
I have the following already implemented.
- A matrix class
- quaternion (I can extract matrix from this)
I can extract the current view direction and I know the view direction of all standard views.
My questions:
- Should the user be allowed to interact and change the view orientation while the transition is in progress. I think yes, but not sure of the behaviour. I do not want the app to freeze irrespective of the state of the system.
- How do I maintain constant rate of change of direction with acceleration and deceleration at the start and end respectively.
- How should frames be rendered while the transition is in progress (500 ms). Is there an elegant way of
doing this in C++11 using std::thread.
If you are already handling user input while rendering, there shouldn’t be a need for a separate thread. If you want the user to still have control just don’t let them control the view matrix directly – rather a target view matrix and simply nudge the current view matrix towards the target a part of the way each frame.
This will complicate the smooth acceleration/deceleration though – say, you start out with a small acceleration, build up speed, and then the user moves the camera: do you start again with a low speed, or do you continue with the same? This is a design decision, but I think the controls would feel weird if the speed the view rotated at changed midway. Also – if you have acceleration/deceleration the rate of change wouldn’t be constant by definition, so you really need to decide what you want, possibly try both solutions and see if it “feels right” for a lack of a better phrase.