Hey,
I’ve got the camera working like first person camera should. i.e up to look up, left,right to turn left or right properly.
But whenever I add a character to the scene, I can’t get it to rotate in the same way. I.e if I rotate the character as I do the camera, it pitches in the same direction no matter which way the model is facing. which means as soon as I turn the character, I can’t look up and down because he then rotates side ways…
The code I use to set the scene up for each entity is this.
for each model
glLoadIdentity()
glRotatef(cameraPitch,1,0,0)
glRotatef(cameraYaw,0,1,0)
glRotatef(cameraRoll,0,0,1)
glTranslatef cameraX-modelX,cameraY-modelY,cameraZ-modelZ
glRotatef(ModelPitch,1,0,0)
glRotatef(ModelYaw,0,1,0)
glRotatef(ModelRoll,0,0,1)
RenderMesh(Model)
}
the result is although I can fly through the level (A single mesh) fine, I can’t get any sort of control on the character model.
I place the camera behind the character model every frame(Taking into account yaw etc)
and basically do this,
modelPitch=ModelPitch+mouseYSpeed()
modelYaw=ModelYaw+MouseXSpeed()
Any help would be great…my engine is almost complete, I only noticed this while doing a little test game(Why I can’t post all the code…it’s alot)