Jump to content
  • Advertisement

Archived

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

Real World

Direct3D v8.1 camera probs

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

What I''m trying to create is a 3d version of snake and i want a camera thats stuck to the front of the head of the snake so you get a 1st person view. I''m having problems because the camera is only working in one direction and in all the other directions i just see black. Below is the code from two of the 4 directions. the down version works prefectly the up version doesnt
if ( m_direction == UP )
		{
			D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(m_playerX * 5.5f, 0, m_playerY * 5.5f+5),		//Camera Position
															 &D3DXVECTOR3(m_playerX * 5.5f, 0, m_playerY * 5.5f + 50),		//Look At Position
															 &D3DXVECTOR3(0.0f, 2.0f, 0.0f));		//Up Direction
		}
		if ( m_direction == DOWN )
		{
			D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(m_playerX * 5.5f, 0, m_playerY * 5.5f-5),		//Camera Position
															 &D3DXVECTOR3(m_playerX * 5.5f, 0, m_playerY * 5.5f- 50),		//Look At Position
															 &D3DXVECTOR3(0.0f, 1.0f, 0.0f));		//Up Direction
 
Theyre both exactly the same apart from i inverted the signs from + to - to represent the other direction. FYIO m_playerX and m_playerY are grid cell references and they are multiplied by 5.5 to get the physical x,y,z coords in space Planetblaze.com - http://www.planetblaze.com - As METAL as it gets!

Share this post


Link to post
Share on other sites
Advertisement
btw I''m aware it should be m_playerZ and not m_playerY but i converted from 2d and havent changed the variable names yet

Planetblaze.com - http://www.planetblaze.com - As METAL as it gets!

Share this post


Link to post
Share on other sites
quote:
Original post by Real World
Theyre both exactly the same apart from i inverted the signs from + to - to represent the other direction.



Well, they''re not EXACTLY the same, the up vectors aren''t the same. On the up part, the Y component of the up vector is 2.0, instead of 1.0. I''m not sure if that would matter or not though...

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!