Sign in to follow this  

how change my movement to time based?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey guys I recently posted a proto version of my project... The only feedback I got was I needed to add time based movement well I was able to get the rotation working time based, but I am trying to figure out how to do the movement the rotation code before and after
//BEFORE

    if (DDown)
    {
     if (CamYaw > -.1)
      CamYaw -= 0.0001f;
    }

    D3DXQuaternionRotationYawPitchRoll(&matViewQuat,CamYaw,CamPitch,CamRoll); 

//AFTER
    if (DDown)
    {
     if (CamYaw > -.1)
      CamYaw -= 0.0001f*60/FPS;
    }

    D3DXQuaternionRotationYawPitchRoll(&matViewQuat,CamYaw*60/FPS,CamPitch*60/FPS,CamRoll*60/FPS); 

The movement I am having trouble with
    if (Eight_Down)
    {
     CameraTranslation -= CameraFront * Eight_Thrust;
     if (Eight_Thrust < MaxThrust)
      Eight_Thrust += ThrustStep;
     }
    else
    {
     if (Eight_Thrust > 0)
      Eight_Thrust -= ThrustStep;
     if (Eight_Thrust - ThrustStep < 0)
      Eight_Thrust = 0;
    }

thanks guys :) here is the version with rotation time based. Ebola_Space any and all comments very welcome :)

Share this post


Link to post
Share on other sites
A simple way?

Keep track of how long it has been since the last time you processed keyboard commands.

Multiply the thrust step size by the delta since the last keyboard processing.

You will have to tweak your units (thrust step size and time delta) to get your accelleration at the right rate.

Share this post


Link to post
Share on other sites
Sign in to follow this