Direct3D v8.1 camera probs

Started by
1 comment, last by Real World 21 years, 1 month ago
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!
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!
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...

This topic is closed to new replies.

Advertisement