Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

tri-thanatos

Problem with Camera

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

ok, I am starting a basic camera class, that just has the ability to move forward/backward,left/right in D3D(since I am new to d3d, thought a camera class would be good experience), everything works right from the stand point of moving my pos, however, how should I move my lookat point to be in relation to the pos?

// here are the vectors values at the beginning

// vPos = (0,0,0)

// vView = (0,0,1)

// vRight = (1,0,0)

// vUp = (0,1,0)


void ICamera::move(unsigned int direction,float fspeed)
{

if(direction == MV_FORWARD)
{

  vPos += vView * fspeed;
}
if(direction == MV_BACK)
{
  vPos -= vView * fspeed;
}
if(direction == MV_RIGHT)
{
  vPos += vRight * fspeed;
}
if(direction == MV_LEFT)
{
  vPos -= vRight * fspeed;
}
};

now how should I modify the view point, as I dont understand if in direct X the view point is a direction, or is an actual point and how I should modify it when I move left/right. thanks, thanatos

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
You could just use a look at point that you move in the same way as you do your camera...check out the D3DXMatrixLookAtLH function. All you need is a camera position, a look at position, an up vector 0,1,0 will do it, and out pops a camera matrix

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!