Attatching viewmodel to camera

Started by
1 comment, last by stroma 19 years, 4 months ago
My Camera class is basicly the same as Gametutorials.com except for some minor changes... and I need to know how to rotate a model the same as the camera, for an FPS... thanks!
Advertisement
In FPS you can rotate freely around the world Y axis and with in a 180 degree arc around the cameras x axis. Its really very simple. When you push the mouse left or right you use the Y axis to rotate around, make sure to rotate every thing opposite since this is the camera you are rotating. And when you push the mouse up and down use the cameras x axis, again make sure to rotate everything by the reverse. The only difference here is to make sure check the angle doesn’t go above 90 or below -90. You can use the vector dot product between the world y axis and the cameras z axis to determine the angle.
i am using a system like this: in render function load the identity matrix and render you model or make the models render before camera movements. works well..
+-+-+-+-+-STR

This topic is closed to new replies.

Advertisement