- Sort Posts
- 5 replies
- Last post
rotation Speed
rotation Speed
As I mentioned earlier I have already done this part.
This was not clear
I just wanted to inquire that is there a way to alter the update time interval time that calls renderQCARFrame?
No - not if you are using the sample.
Besides, the best way is to change the code shown, as it uses real time values to calculate the delta.
N
rotation Speed
rotation Speed
Here is how you could have found this out for yourself:
1 - understand the samples and the fact that the update loop is in EAGLView.mm - it is called renderFramQCAR() - and explore
2 - do a search for "rotate" - seems logical
This would reveal the following method:
animateBowl(QCAR::Matrix44F& modelViewMatrix)
{
static float rotateBowlAngle = 0.0f;
static double prevTime = getCurrentTime();
double time = getCurrentTime(); // Get real time difference
float dt = (float)(time-prevTime); // from frame to frame
rotateBowlAngle += dt * 180.0f/3.1415f; // Animate angle based on time
ShaderUtils::rotatePoseMatrix(rotateBowlAngle, 0.0f, 1.0f, 0.0f,
&modelViewMatrix.data[0]);
prevTime = time;
}
It ought to be fairly easy for you to figure out the rest.
N
For others who just want to play aroud with the rotational speed. In the sample code:
//subtracting time from dt will decrease the rotational speed
rotationAngle += (dt-0.01) * 180.0f/3.1415f;
Hope it helps somebody