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.

Author
Message
Dimension
22
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 4th Aug 2010 03:12
I'm working on functions that control the camera and I'm currently working on panning the camera. I'm trying to make this function like other 3D modeling program where when you drag it looks like you are dragging the grid, I hope that makes since. Does anybody know how to do this?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Aug 2010 11:02
Try:


...edit the "1.0" value until it moves at the speed you want it to

Dimension
22
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 4th Aug 2010 12:15
I believe that is almost the exact same code I used at first but if you use this code it looks a lot different than other 3D modeling programs because the mouse pans the camera to fast. Its almost like the width of the screen is the width of the 3D space that is viewable. I could try finding a multiplier but I think it is best to try and figure out the right way of doing it that way its professionally done.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Aug 2010 12:28
Most 3D modelling programs use a 'viewpoint' in 3D space, as in a point that the camera is looking at. You can then use a scale based on the distance from the camera to the viewpoint. You can base the viewpoint on the position of the currently selected object or on a point selected by the user (I used this method in my editor "ID8").

I'll post some code...


...where VX#,VY#,VZ# are the viewpoint. You may still have to experiment with the ".01" to get the desired speed though. Life is tough sometimes...

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 5th Aug 2010 22:54
Here is an ORBIT function:

You need to assign globals:
AngleX#, AngleY#, CamerX#, CameraY#, CameraZ#, and CameraDistance#

CamerX#, CameraY#, and CameraZ# are the FOCAL POINT of the orbit.

You can do a XYZ MOVE function a few ways. I don't have an example code that I can give you right now, but it's not that complicated. You can simply position the camera at the CamerX#, CameraY#, and CameraZ# and move the camera forward using the mousey() return, move it left/right using the mousex() return. If you want to put constraints on an axis, it will be a little different, but I think you can figure that out on your own. If you can't, let me know, and I'll give you a couple examples.

The fastest code is the code never written.

Login to post a reply

Server time is: 2026-07-25 02:46:58
Your offset time is: 2026-07-25 02:46:58