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.

DarkBASIC Professional Discussion / Multiple Axis Orbit

Author
Message
Master Man Of Justice
18
Years of Service
User Offline
Joined: 13th Feb 2008
Location: Between Insanity and Intelligence
Posted: 22nd Feb 2011 08:37
Ok, So i know how to do orbit around the y axis (horizontal).
But i want to have Vertical orbit as well(at the same time).

basically, think of what im trying to do, as a 3d reticule (not what im trying to do, but close). it stays in the center of the screen at all times, it rotates with the camera, but the object (lets say a cube) stays in 3d space.

I would really appreciate the help

enderleit
19
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 22nd Feb 2011 18:55 Edited at: 22nd Feb 2011 18:59
Not sure if this is what you want, but couldn't you just point the object towards the camera?

EDIT: Do you want the object to be affected by the cameras rotation or the camera to be affected by the objects rotation?

Master Man Of Justice
18
Years of Service
User Offline
Joined: 13th Feb 2008
Location: Between Insanity and Intelligence
Posted: 22nd Feb 2011 20:00
Object is affected by camera rotation.
Although im thinking about switching it. Which would make it much easier huh? lol.

Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 22nd Feb 2011 21:20 Edited at: 22nd Feb 2011 21:33
I believe I wrote a little function to do this a while ago. Lemme dig around and I'll edit this post if I find it.

Edit: Found it!



Parameters:
Camera - The camera to orbit around
Object - The object to move
ViewXPos as float - The object's X position relative to the camera's orientation.
ViewYPos as float - The object's Y position relative to the camera's orientation.
ViewZPos as float - The object's Z position relative to the camera's orientation.
ViewXAng as float - The object's X rotation relative to the camera's orientation.
ViewYAng as float - The object's Y rotation relative to the camera's orientation.
ViewZAng as float - The object's Z rotation relative to the camera's orientation.
DisableZDepth - A flag to disable the object's Z-Depth. Set to 1 if you want the object to be drawn over everything else.

Master Man Of Justice
18
Years of Service
User Offline
Joined: 13th Feb 2008
Location: Between Insanity and Intelligence
Posted: 23rd Feb 2011 02:21
Kira, maybe im missing something, but after looking at your function, i dont see how it is supposed to make the object orbit. Even on one axis. Thank you though i hope you can help me understand.

Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 23rd Feb 2011 02:43
Perhaps I've misunderstood what you're looking for. Here's a little demo that showcases my function. It makes some objects and keeps them in the same spot on the screen regardless of the camera's orientation:



Master Man Of Justice
18
Years of Service
User Offline
Joined: 13th Feb 2008
Location: Between Insanity and Intelligence
Posted: 23rd Feb 2011 03:08
Oh ok, i see now, Thank you for that, now i can use it the right way. I should have examined what the function did more before i bugged you. But thank you And yes, that is what i wanted.

Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 23rd Feb 2011 03:09
Glad I could help.

Login to post a reply

Server time is: 2026-07-17 17:23:53
Your offset time is: 2026-07-17 17:23:53