Sign in to follow this  
Ebola0001

how change my movement to time based?

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this