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.

DLL Talk / DBP - EZ Rotate planet orbit trouble

Author
Message
Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 27th Jan 2011 16:06
Hello,
I have a question regarding the orbit function within EZ rotate.

I can make some spheres, I can get one sphere to orbit the other sphere, however, if I move the centeral sphere, the orbit goes all out of wack.

This is what Ive got...



I'm curious as to how you can move an object and maintain the same unaltered orbit for its satellite eg, the radius of the orbit doesnt grow or shrink with movement.

my end goal is to have multiple levels of orbit eg, sun planets moons etc, and id like to be able to move the planets through space without distorted orbits.

Im still a newcomer to Dark basic and im trying to work it out for myself, however on this one, i seem to be going round in circles which is what my planets are meant to be doing.

what am i doing wrong?
thankyou
kezz

Sometimes I like to use words out of contents
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 27th Jan 2011 17:37
EZRotate isn't really necessary for that. If you're after just a flat round orbit, then,



The amount you add to the angle determines the speed of the orbit.

dist# is the distance between the object and the object it's orbiting.

XOrigin# and ZOrigin# are the X and Z positions of the object the object is orbiting.

So if your Sun is at 0,0,0 then XOrigin# and ZOrigin# for Earth would be 0 and 0, and for the Moon they would be the current X and Z position of the Earth.

There's formulas out there for elliptical orbits, and orbits that don't remain on a flat axis.

For the time it takes DBPro to make a call to a DLL you can calculate the orbit yourself and have more control over it.

Hope that helps.

Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 28th Jan 2011 13:52
Thank-you KISTech,
that is a big help and greatly appreciated.
kezzla

Sometimes I like to use words out of contents
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 31st Jan 2011 17:31
You don't really need a formula for elliptical orbits either. You can build a transformation matrix that transforms a circular orbit to an elliptical one.


The transformation matrix will convert a vector3 on a circle with radius 1 to an ellipse with given width, height, inclination angle, Y angle and it will also offset the ellipse so that the 'sun' is placed in one of the foci of the ellipse.

Cheers!
Sven B

Login to post a reply

Server time is: 2024-11-23 10:22:22
Your offset time is: 2024-11-23 10:22:22