Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / A misunderstanding with rotation - DBP

Author
Message
Hazviz
18
Years of Service
User Offline
Joined: 12th Jun 2006
Location: Alnwick, UK
Posted: 15th Jun 2006 18:25
Hey everyone,
I was recently reading through the code examples on the MatEdit website(I know they are for DBC but there are some great tips on there that apply for both) and found a code for camera rotation when the user moves the mouse.

Now, pasting and learning this code has meant I can now do this, but what I dont understand is the rotation aspect of it...



Now, why are we checking the movement of the Y axis movement on the mouse for the X rotation value of the camera... And vice versa...?

When I switch it round and put mousemovementx() for cx# the camera movement is totally wrong, so obviously there is something I am missing and just not understanding here about why we have to check the oposite axis when talking about the mouse...

Thanks
Hazviz
18
Years of Service
User Offline
Joined: 12th Jun 2006
Location: Alnwick, UK
Posted: 15th Jun 2006 19:32
Oh, wait...
Nevermind After a little more careful thought I managed to realise the way in which objects rotate around their different axii, hehe.

But now I've got another problem...

I can do "move camera 1, 0.5" fine...
But how about if I wanted the camera to strafe?

Thanks
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 16th Jun 2006 00:12 Edited at: 16th Jun 2006 00:13
You can simply-

yrotate camera camera angle y()+90
move camera (however much you want to move it right. A negative number for left)
yrotate camera camera angle y()-90


I posted an example of an easy way to control the camera with arrowkeys here

Insanity is just a state of mind
Hazviz
18
Years of Service
User Offline
Joined: 12th Jun 2006
Location: Alnwick, UK
Posted: 16th Jun 2006 01:09
Thanks Daemon, works a charm!

Login to post a reply

Server time is: 2024-09-25 01:33:44
Your offset time is: 2024-09-25 01:33:44