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 / Orbiting...

Author
Message
TGWDNGHN
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 23rd Oct 2002 01:23
I made a Sun and made a planet revolve around it using a simple Pitch Object Left command...Now I want a moon to revolve around a planet...can someone give me a snippet where I can specify the x,y,z I want to revolve around, the x,y,z angle i want to revolve by and the distance away to revolve around?
ChipOne
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 23rd Oct 2002 02:17
this is a fun one

you don't need to use the PITCH OBJECT commands. using sin and cos is all you need. oh, the joys of math.



-= i only do what my rice krispies tell me to do =-
ChipOne
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 23rd Oct 2002 02:27
by the way, here's how those calc's work:
for the planet, 15.0 is the distance from the centre of the sun. 4.0 is the height above and below the equater of the sun that the planet will position itself.

for the moon, the numbers are 5.0 and 1.5 respectively for the same items.

hope this helps!

-= i only do what my rice krispies tell me to do =-
ChipOne
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 23rd Oct 2002 02:33
and tgwdnghn, whatever that means, i just noticed that you cross-posted against all the other forums.

very uncool.

you won't likely get much help anymore if you're caught doing that. your question will be answered if it's valid, on topic, and NOT CROSS-POSTED.

-= i only do what my rice krispies tell me to do =-
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 24th Oct 2002 00:56
That's close, but it's not the one. It works well enough to be acceptable, but isn't quite perfect, I'm working on a perfect function now. Perfect meaning the maths is perfect in theory. There are lots of sine and cosine functions in it . Sine and cosine are the most useful maths functions I've come across, but then I've only dabbled with rotation matrices and the like. Which coincidentally use sin and cos.
ChipOne
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Canada
Posted: 24th Oct 2002 02:36
hmm...how do you mean perfect? the planet rotates around the sun and the moon around the planet. the movement is smooth.

interested in seeing your code...

-= i only do what my rice krispies tell me to do =-
NickIgoe
22
Years of Service
User Offline
Joined: 20th Oct 2002
Location: A bar somewhere
Posted: 24th Oct 2002 02:49
Having had simalar problems with the pitch & roll commands, Basically reading off the x,y,z rotations, I found that if I created another invisible object then used the set object orientation command to copy the rotations from the original object to the invisible one I was able to to read off the rotations that way. Not a perfect solution but It worked. And saved my hair at the same time. Hope it helps
TGWDNGHN
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 26th Oct 2002 01:00
Some really nice guy gave me a snippet for the Camera...

and I edited it to
TGWDNGHN
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 26th Oct 2002 01:01
Oh yea and I almost forgot...to my gun problem which you guys might have heard about...should I use this orbit code (its manual )to position my gun?
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 27th Oct 2002 22:19
What tgwdnghn posted is almost exactly what I had, I just structured mine a bit differently. What I mean by perfect is that that will orbit the object in a circle whatever values you put in. Your code allows incredibly elliptical orbits (not that it's bad, just a different way to do it). Of course you could include scaling values into my function to get elliptical orbits.

Login to post a reply

Server time is: 2024-11-23 17:35:43
Your offset time is: 2024-11-23 17:35:43