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.

3 Dimensional Chat / Camera Scrolling

Author
Message
Codger
17
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 30th Dec 2002 21:43
Using the mouse x,y I need to pan 360 degrees around an object, the mouse z (wheel) to zoom in out, I tried the following

position camera 1, mousex(), Mousez(), Mousey ()
point camera 1,0,0,0

but it is really ugly. any suggestions?
Dr DooMer
17
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 31st Dec 2002 02:58
Trigonometry!

Use the mousemovex() and mousemovey() to change two angle variables, then use trigonometry to calculate a camera position in 3D space and point the camera towards 0,0,0.

You could simplify it by restricting the movement to effectively 2D circular motion by the mousex, and then allowing the mousey to only change the height of the camera.

And, because I'm a nice guy, here's some code I made a while ago:



This won't work if you just copy/paste it, I'm afraid, as I've just ripped the important bits straight out of a little app type thing I made.

"I am a living, thinking entity who was created in the sea of information."

Login to post a reply

Server time is: 2020-08-06 08:53:14
Your offset time is: 2020-08-06 08:53:14