Log in or register to post comments

rotation Speed

September 3, 2013 - 3:32am #1

Can you help me refer as to how can I alter the speed of rotation in the multitarget sample application. I mean I want the bowl to rotate slowly with less rotational speed. Any idea?

 

Regards

rotation Speed

September 3, 2013 - 5:26am #6

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

rotation Speed

September 3, 2013 - 5:17am #5

Well I just did what I was looking for. In the update call I changed the angular speed by reducing the frame time.So its fixed now. Wish SDK would have provide any info on that but hit and trial did that for me.

 

 

rotation Speed

September 3, 2013 - 5:08am #4

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.

 

rotation Speed

September 3, 2013 - 4:57am #3

As I mentioned earlier I have already done this part. I just wanted to inquire that is there a way to alter the update time interval time that calls renderQCARFrame? That will automatically adjust the speed of the rotation.

 

rotation Speed

September 3, 2013 - 4:47am #2

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

 

 

 

Log in or register to post comments