This is only an outline of what you have to do:
sounds like you want is Newtonian gravity.
Fg = [G * (m1 * m2)] * R^-2
where:
- G is a constant
- m1 and m2 are the masses of the objects
- R is the distance between the objects.
to make it easy you could say everyone has a mass of 1 and then play with
the constant to get the desired effect. The formula gives you the attractive
force exerted by the bodies on each other, so you'll have to use:
F = ma
to figure out the position vectors. If you want to avoid solving second
order diferential equations, I suggest you try to find some simplifying
assumptions.
Contact me off list if you need more help - this isn't a newtonian mechanics
list after all.
Patrick Griffiths
Software Engineer
Integration New Media Inc.
http://www.integration.qc.ca
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Kerry Thompson
> Sent: Monday, October 16, 2000 12:12 PM
> To: [EMAIL PROTECTED]
> Subject: <lingo-l> Calculus & Vectors
>
>
> I've been working all weekend to come up with a formula for
> this, and I
> realize now I probably should have gone ahead with that third
> semester of
> calculus.
>
> Here's the problem. I have one main sprite that floats around
> the screen. I
> also have 44 other sprites scattered around the screen, each
> confined to an
> area about 100 x 100.
>
> I want the floating sprite to exert sort of a planetary
> gravity effect on
> the other sprites. As the floating sprite approaches a fixed
> sprite, that
> fixed sprite should start moving towards the floating sprite,
> but stay
> within its 100 x 100 rectangle. Ideally, the closer the
> floating sprite
> gets, the more the stationary sprite should be
> attracted--i.e., the faster
> it should move.
>
> The reverse should happen, too--as the floating sprite moves
> away, the
> fixed sprites should follow, but slower and slower as the
> floater moves
> farther away. At some point--probably when the floater is
> about 200 pixels
> away--the fixed sprite will drift back to its original location (that
> part's already done).
>
> So, does somebody have a formula to do this? If it's in lingo
> form, great.
> If not, I can convert it easily.
>
> Cordially,
> Kerry Thompson
> Sr. Interface Engineer
> Learning Network
>
>
> [To remove yourself from this list, or to change to digest mode, go to
> http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
> email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
> Lingo-L is for learning and helping with programming Lingo. Thanks!]
>
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]