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
rapscaLLion
16
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 4th Oct 2002 01:21
Alright, I have tried to do this multiple ways, but nothing works...
Can someone explain/write code on how to make a camera orbit a certain point?
IE- Imagine a camera that is tied to a point to a piece of string. It can orbit around that point, but it is always looking at the point. It can also move closer or farther from the point, but it is always focused on the point. Understand?

I need this for an editor I'm making. I have tried to puzzle it out, but I just don't know enough about math involved.

Thanks

Alex Wanuch
Alex Wanuch
aka rapscaLLion
Get the DB Weekly Newsletter at www.dbwn.cjb.net
deadlyduck
16
Years of Service
User Offline
Joined: 19th Sep 2002
Location: United Kingdom
Posted: 4th Oct 2002 01:30
Just done that myself so heres the code





check out my Animated Dolphin Screensaver to see it in action
http://www.darkbasicpro.com/apollo/view.php?t=633&b=5
The Darthster
16
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 4th Oct 2002 02:04
An easier way of doing that is by using sine and cosine. You can define a circle using sin and cos, so this is what I use for orbits.



a# is an angle that determines where the camera is.
x# is the x position of the point to be orbited.
z# is the z position of the point to be orbited.
dist# is the distance from the camera to the object.
height# is the height above the point to be orbited.

Note this orbits in the xz plane only, to orbit in other planes just put the sin and cos functions in different camera axes. If you are making an editor then you will most likely need 3d orbits (homeworld-style camera), I wrote some code for that a while back, I'll tell you if I can remember it.
The Darthster
16
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 4th Oct 2002 02:24
I've figured out the code for a proper 3d homeworld-style camera, probably the most useful for an editor.



a# is an angle that determines the horizontal rotation of the camera.
b# is an angle that determines the vertical rotation of the camera.
x# is the x position of the point to be orbited.
y# is the y position of the point to be orbited.
z# is the z position of the point to be orbited.
dist# is the distance from the camera to the object.

This will orbit a point using the mouse.
rapscaLLion
16
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 4th Oct 2002 03:03
Thanks A TON guys, I will test these out!

Alex Wanuch
aka rapscaLLion
Get the DB Weekly Newsletter at www.dbwn.cjb.net
rapscaLLion
16
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 4th Oct 2002 06:10
It works beautifully now, thanks!

Alex Wanuch
aka rapscaLLion
Get the DB Weekly Newsletter at www.dbwn.cjb.net
The Darthster
16
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 4th Oct 2002 22:47
No problem! (assuming you used my code)
rapscaLLion
16
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 5th Oct 2002 04:42
I did

Alex Wanuch
aka rapscaLLion
Get the DB Weekly Newsletter at www.dbwn.cjb.net
The Darthster
16
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 6th Oct 2002 00:49
VietStylist
16
Years of Service
User Offline
Joined: 20th Sep 2002
Location: Australia
Posted: 6th Oct 2002 12:42
Hmmm... My snippet does the same thing (but smoothly) but is way longer.

Vs

Login to post a reply

Server time is: 2019-05-24 01:47:13
Your offset time is: 2019-05-24 01:47:13