Simulating Gravity (Or Any Attractive Force)

Tutorials Shared by the Internet Community


Simulating Gravity (Or Any Attractive Force)

This tutorial shows you how to simulate an attractive force like gravity between two objects like planets.


  • Total Hits - 35215

  • Total Votes - 102 votes

  • Vote Up - 44 votes

  • Vote Down - 58 votes

  • Domain -

  • Category - Flash/Math & Physics

  • Submitted By - Devesh Khanna

  • Submitted on - 2008-04-02 11:21:41


Here are the steps I took to make this.

1. I created a sun movieclip and an earth movieclip and placed them on the stage with instance names ball1 and ball2 respectively.
2. I used FlashGuru's function that determines the distance between two movieclips and returns a distance object (with a slight modification).
3. Using the info in the distance object I determined what the velocities and accelerations of the bodies.    More detail...

Broken  |   Save  |   Liked  |   Down

E-Books Store