Sign in to follow this  

Weapons and looking around

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

I tried to load a Q3 model in a simple application and I managed to position the camera at 'the face' of the md3 model. When I move across the room in the picture http://img49.imageshack.us/my.php?image=2hc1.jpg all the things are OK, but when i trie to look around with the mouse only the view point is rotating and the model is not. The view is rotateing around the model's origin. http://img446.imageshack.us/my.php?image=1br3.jpg Can somebody tell me how to make the weapon move when I move the mouse and to be at the center of the screen wherever I look. My english sucks, hope you understood me.

Share this post


Link to post
Share on other sites
I havent done too much with FPS's but i would say to double check if the rotation/vector of the weapon being updated when you move the camera around. Just make sure it follows the camera.

Share this post


Link to post
Share on other sites
What you'll want to do is translate the model to the point you want to rotate it around. Then you'll want to rotate it to be the same as the players rotation. Afterwards you might want to translate it again to move it forward into a precise position. If you're using OpenGL, you can use glPushMatrix, glTranslatef, glRotatef, and glPopMatrix.

Share this post


Link to post
Share on other sites
Yeah. From the looks of it, you arent rotating the model. You are only rotating the camera. The model itself is sitting in world space. You need to do what ScottC was mentioning before you draw the model. or you might have to rotate it before translating it. But either way, you need to rotate the model.

Share this post


Link to post
Share on other sites
Isn't there a trick, like the inverse of the camera's view matrix would be a matrix that would translate an object to the same position as the camera?

Share this post


Link to post
Share on other sites

This topic is 4093 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this