Skip to main content
GameDev.net gamedev.net
🔒 Locked

Mouse look camera problem

Started by WonderWorld Aug 4, 2002 at 11:46 AM 0 replies 250+ views
Original Post
WonderWorld
WonderWorld
Hi I am having problems implementing the correct movement of my mouse camera. I have tried with this (pseudo code) tmpVec, tmpMat2; tmpVec = camMatPos; camMatPos = 0; D3DXMatrixRotateX(tmpMat2, input); D3DXMatrixMultiply(camMat, camMat, tmpMat2); camMatPos = tmpVec; SetView(); This gives the result that the object I am looking at appears to rotate. But if I don''t set the camMatPos to 0 then it works better but the object rotates (which I think it shouldn''t) when I move the mouse in a rotating motion changing X and Y pos of the input. Can someone explain the error I am making and give me some code that is working? Thanks
tok_junior
tok_junior
First of all, are you using DirectInput?
This doesn''t give absolute coordinates, it only gives you the number of ticks the mouse has moved since the last poll.
Keep 2 counters, one for x and one for y, and add what you get back from DInput to it every frame. Then rotate by the counters.
Make sure you''re not resetting the viewmatrix when rendering the rest of the scene, as this would mean the object would look like it rotated.
And the code, you''ll have to work out yourself, not too hard, eh?


--
MFC is sorta like the swedish police... It''''s full of crap, and nothing can communicate with anything else.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.