# calculate the time... traslation of object 5mm in 1 sec..

This topic is 2191 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys..

I am stuck at this point... I couldn't figure it out how to calculate the feedrate and how can I impliment. I have tried alot but now don't know what to do..

Actually the problem is .. I want to translate one object that will cover 5.555 mm in 1 sec.. so it means that 100mm in 18 sec..
I have obtained the results that is 100mm in 18sec but when the fps is 59...

but when I start my simulation, the fps goes to 14... then the object moves very slowly, it does not covers 100mm in 18 sec.. it takes too much time..

my code is..

 void ModelRotation_IdleFunc(void) { CurrentTime = clock(); float timeInterval = CurrentTime - PreviousTime; C_TOOL_X += (5.5555f/(1000.0*3.24*timeInterval*0.001f)); if(C_TOOL_X > 100.0) C_TOOL_X = C_TOOL_X - 100.0; PreviousTime = CurrentTime; glutPostRedisplay(); } 

kindly guide me how can i do this... I think fps must be considered in my code.. but how ?

##### Share on other sites
A basic fps independent movementspeed example:
float stepsize = elapsedTimeSinceLastFrame * speed; position += stepsize; 
This example does work, just try to adjust it so it fits your x meter / second.

##### Share on other sites
Yes Thanks it works...

• 10
• 12
• 10
• 10
• 11