So, I implemented ray-picking for objects:
Selected Meshy
Selected MeshyJr
And since that only took a few minutes I decided to move onto lighting. That didn't turn out so well[sad]. I think the problem is in the mesh or something (screwed up normals; maybe not though.) Anyway, in the following screenshots, the light moves to the selected mesh:
Or, then again that may be how it should look. I haven't had much practice with lights.
My lack of 3D knowledge is really becoming a roadblock lol. For instance, when my camera moves into the negative Z, all of my meshes disappear and I have no clue why lol.
Edit: I'm thinking the above problem has to do with my camera code (duh, right?) Anyway, I do have something really wierd going on:
D3DXMATRIX ViewMatrix, RotX, RotY, RotZ;D3DXMatrixRotationX(&RotX, D3DXToRadian(CameraYaw));D3DXMatrixRotationY(&RotY, D3DXToRadian(CameraPitch));D3DXMatrixRotationZ(&RotZ, D3DXToRadian(CameraRoll));D3DXVECTOR3 Movement = D3DXVECTOR3(0.0f, 0.0f, 0.0f);if(this->KeyStates[VK_LEFT] || this->KeyStates[VK_NUMPAD4])Movement.x += (1.0f * (1.0f / DeltaTime));if(this->KeyStates[VK_RIGHT] || this->KeyStates[VK_NUMPAD6])Movement.x -= (1.0f * (1.0f / DeltaTime));if((this->KeyStates[VK_UP] || this->KeyStates[VK_NUMPAD8]) && !this->KeyStates[VK_CONTROL])Movement.y += (1.0f * (1.0f / DeltaTime));if((this->KeyStates[VK_DOWN] || this->KeyStates[VK_NUMPAD2]) && !this->KeyStates[VK_CONTROL])Movement.y -= (1.0f * (1.0f / DeltaTime));if((this->KeyStates[VK_UP] || this->KeyStates[VK_NUMPAD8]) && this->KeyStates[VK_CONTROL])Movement.z -= (1.0f * (1.0f / DeltaTime));if((this->KeyStates[VK_DOWN] || this->KeyStates[VK_NUMPAD2]) && this->KeyStates[VK_CONTROL])Movement.z += (1.0f * (1.0f / DeltaTime));D3DXVec3TransformCoord(&Movement, &Movement, &(RotX * RotY * RotZ));CameraX += Movement.x;CameraY -= Movement.y; //<-- THIS LINECameraZ += Movement.z;
Okay, with that code, when I press up or down, it slides just how I want it to. It moves according to the angle of the terrain (it goes toward and away from the terrain, instead of up and down.) BUT, if I change it to +=, it does move up and down.