|
![](/i/fill.gif) |
> There's a chance you could help. Do you have the patience of a saint?
> The perseverance of a bulldog? The kindness of a mother and the wisdom of
> Job?
Patience of a saint? My friends often call me The Saint or Simon Templar, but
it might be for other reasons... As for the others, I dunno... But it cost not
much to try, so why not!
> In that case I would love to learn about orbits.
The planets -as any other things- have a few vector values: Force(F), Speed(v),
Position(s) and Acceleration(a) (I'm french but I think the variables are
universal)
A vector is somewhat a line that goes from the origin and points out with a
Length and a Direction.
A car that is always running at 100mph will have a Speed vector of length 100mph
and any direction it is going in.... But then the accelerations for making it
turn are a bit complex... Just as the ones that will move the planets into
orbit ;)
The relation between the vectors goes like this:
F = ma (where m is the mass of the object)
so a = F/m
vf = vi + a(Delta t) (vf = final speed, vi = initial speed, Delta t is the
elapsed time since vi to vf)
(Delta s) = vi*(Delta t) + (a (Delta t)^2)/2
Delta is is the movement since last position, you just add (si) to (Delta s)
It is possible to multiply/divide a vector with a constant, such as (F = ma).
You would only have to multiply the Length of the vector with the constant or
divide. And the direction stays the same.
When adding vectors together, -let me try this graphically- you draw the first
vector as a line (point A to B) of length Length and angle Direction. Then you
draw the second vector with point C over point B and then from there you draw
the line with length Length and angle Direction:
(C)
/
/
/
(A)------------(B)
or
(B).........
/ \ angle |
/ \ /
/___ \____/
/ \ \
/ \ \
/ angle | \
(A)........ (C)
So now that you know how to compute the length of the final position of a car
going in a direction. You might'd like to know how to get the vector's
component, that is X, Y, Z. If you want to work in 3D you'll need two Angles
for the direction, but you don't need it for your planets, since they'll move in
a 2D axis...
X = Length * cos( angle )
Y = Length * sin( angle )
You can now move the car to that position and then rotate it to face its
direction and continue playing...
Sorry for the lack of drawings, if the too many formulaes and explanations
comfused you too much I might try to rewrite this in a PDF with pictures and
good formulas...
At last the gravitationnal formula:
F = G * ( m1 * m2 )/(d^2)
Where m1 is the mass of current planet,
m2 is the mass of second planet,
d is the distance that separate both planets,
and G is the gravitationnal constant:
G = 6.67 *10^-11 (unit: N*m^2/kg^2)
Hmm, since you would need d to be a vector and then have the multiplication of a
vector with another vector (d^2)... This is very difficult to explain, i'll try
in another post... Try to understand what I just said in this post as a first
lesson, then we'll move on to the next!
Simon
--
|| 'How do you know I'm mad?' said Alice.
|| 'You must be,' said the Cat, 'or you wouldn't have come here.'
--
Simon Lemieux (lem### [at] yahoo com)
Post a reply to this message
|
![](/i/fill.gif) |