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.

Dark GDK / Advanced Orbital Movement

Author
Message
Ice125
15
Years of Service
User Offline
Joined: 4th Mar 2009
Location:
Posted: 17th Mar 2009 14:56
I'm trying to make an orbit mechanic and Ive been trying for the last week, but i just cant figure out how to do it, i hate trig lol...

Im trying to do this:
Ship B Orbits around Ship A at Specified Distance (eg: 1km)
While keeping in mind the Max (Local Axis)Rotation speed (eg: 6dagrees/s) and the max movement speed (eg: 300 m/s)
Also taking into account the movements of Ship A

(If any of you have played Eve-Online thats the type of orbit im trying to recreate)

If ShipB's rot and movement speeds are not high enough to keep a stable orbit for X distance, the ship should orbit at the minimum distance possible (with the right math this should happen anyway)
(Note: I have EZRotate, I would include some snipplets but right now the code is a mess and dosent work at all)
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 17th Mar 2009 16:24
Rather short of time here, so I'm just gonna give you a few equations you can use to calculate a new position when dealing with orbiting.

X, Y and Z are the positions of the orbiting object, OX, OY and OZ are the positions of the origin that the orbiting object will rotate around (in this case, the positions of Ship B), AngX and AngY are the offset angles from the Ship B to Ship A, that is, you rotate down AngX deg, and round AngY deg, and finally, Dist is the distance you want to orbit from the origin:

X = OX + sin( AngY ) * cos( AngX ) * Dist
Y = OY - sin( AngX ) * Dist
Z = OZ + cos( AngY ) * cos( AngX ) * Dist


You can take it from there I'm sure.
Ice125
15
Years of Service
User Offline
Joined: 4th Mar 2009
Location:
Posted: 17th Mar 2009 16:45
yes, that creates an orbit path, but it dose not implement rotation speeds ect...

Basicly the only movement Ship B will have is ShipB->MoveForward
no dbSetObjectPosition...

It has to all be centered around rotation, and rotation speeds

Login to post a reply

Server time is: 2024-09-30 21:28:18
Your offset time is: 2024-09-30 21:28:18