Jump to content
  • Advertisement
Sign in to follow this  
arkerone

onFrameMove and jerky camera

This topic is 2383 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

Hi everybody,

I have a problem, I use DXUT and at times when I move my camera, it's jerky.
I use these callback :
DXUTSetCallbackFrameMove (OnFrameMove, scene);
DXUTSetCallbackD3D11FrameRender (OnFrameRender, scene);

void WINAPI OnFrameMove( double fTime, float fElapsedTime, void* pUserContext ) {
Scene &s = *static_cast<Scene*>(pUserContext);
// if the camera move
if(s.pCamera.getMove()){
s.pCamera.frameMove(fElapsedTime); // update the position
s.pCamera.render(); // compute the matrix
s.pCamera.renderReflection(s.pWaterPlane->getHeight()); // compute the matrix of reflection
}

//move the water
s.pShaderWater.setWaterMove(s.pShaderWater.getWaterMove() + 0.0001f);
if(s.pShaderWater.getWaterMove() > 1.0f)
{
s.pShaderWater.setWaterMove(s.pShaderWater.getWaterMove()- 1.0f);
}
};


The message callback :
LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam,bool *pbNoFurtherProcessing,void *pUserContext)
{
Scene &s = *static_cast<Scene*>(pUserContext);
switch( msg ) {
case WM_KEYDOWN:{
switch(wParam) {
case VK_UP : s.pCamera.setMoveForward(true);break;
case VK_DOWN : s.pCamera.setMoveBackward(true);break;
case VK_LEFT: s.pCamera.setMoveLeft(true);break;
case VK_RIGHT : s.pCamera.setMoveRight(true);break;
case 'A': s.pCamera.setMoveUp(true);break;
case 'Z' : s.pCamera.setMoveDown(true);break;
}
}
break;
case WM_KEYUP:{
switch(wParam) {
case VK_UP : s.pCamera.setMoveForward(false);break;
case VK_DOWN : s.pCamera.setMoveBackward(false);break;
case VK_LEFT: s.pCamera.setMoveLeft(false);break;
case VK_RIGHT : s.pCamera.setMoveRight(false);break;
case 'A': s.pCamera.setMoveUp(false);break;
case 'Z' : s.pCamera.setMoveDown(false);break;
}
}
break
}
return 0;
}


And the move function :

void Camera::MoveForward(float p_time){
if(m_moveForward)
m_position.z+=m_speed * p_time;
}


and in my function onFrameRender , i draw the differents objects of my scene one by one.

in 7 sec my camera jumps:
[media]
[/media]

An idea of this problem?

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!