BehaviourComposer: ignore everything before this.
Begin micro-behaviour:
Begin description:
Update the velocity of an object accordinng to the gravitational pull of the other body.
End description
Update velocity
Begin NetLogo code:
let other-body myself let distance-to-other distance myself let mass-of-other [ my-mass ] of myself face other-body let heading-to-other heading let pitch-to-other pitch ask my-velocity [ set heading heading-to-other set pitch pitch-to-other jump g * mass-of-other / distance-to-other ^ the-inverse-law set heading 180 + towardsxy my-origin-x my-origin-y ]
End NetLogo code
Authored by Maria Marinari and Ken Kahn.
BehaviourComposer: ignore everything after this.