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

need help please!

Started by 31337noob Jun 24, 2004 at 5:33 PM 5 replies 550+ views
Original Post
31337noob
31337noob
how would i use the mouse to do freelook on the camera? sample code please. thanks in advance.
circlesoft
circlesoft
Check out the DirectInput tutorials in the SDK. Here is the directory: DirectInput -> DirectInput C/C++ Tutorials. Also, Andy Pike has an input tutorial.

Basically, you just get input from the keyboard and mouse, then use these values to modify the camera position and build it's matrix. To see a good example of this, look at the Cull sample in the SDK. Doing a search of the DirectX forum is going to come up with tons of results, too.
imDivineLight
imDivineLight
// this is my yaw function void mCamera.Yaw( float fAngle )// & this is my pitch function void mCamera.pitch( float fAngle )mCamera.Yaw( mpDeviceMouse->mMouseState.lX * mfGameSpeed * 		 0.00125f ); mCamera.Pitch( mpDeviceMouse->mMouseState.lY * mfGameSpeed * 		0.00125f );


You look all it depends on how you have implemented your camera and input classes. by the way these calculations are done on relative positions of my mouse rather than buffered.
::- Hear the beauty of silence -::
31337noob
31337noob
Quote:
Original post by imDivineLight
*** Source Snippet Removed ***

You look all it depends on how you have implemented your camera and input classes. by the way these calculations are done on relative positions of my mouse rather than buffered.


whats mpDeviceMouse?
Supernat02
Supernat02
That is the DirectInput device for the mouse.
Chris ByersMicrosoft DirectX MVP - 2005
31337noob
31337noob
thanks i got it working.
imDivineLight
imDivineLight
Quote:
Original post by 31337noob
thanks i got it working.


It makes me feel happy!, if you want further assistance, you can freely add me on you'r MSN, if you want. actually i have a little DX Discussion group on MSN, in which we share ideas and common talks about game dev :)
::- Hear the beauty of silence -::

Topic Locked

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

Sign in to reply to this topic.