Code Monkey home page Code Monkey logo

gravity-simulator's Introduction

Gravity Simulator

Place planets anywhere and set their velocities and sizes. Each planet will exert a force on every other planet according to Newton's Law of Gravitation. If planets touch, they will collide inelastically.

This project was made using libGDX. See the libGDX Javadocs here.

How to run

Download and run gravity_simulator.exe. This file consists of the compiled source code and jars in the libs folder bundled into an exe using Launch4j.

Or, after downloading this repository you can compile and run the code on your computer. run.bat contains the commands to do this. This may not work if you use jdk 9 or above.

Controls

  • Drag the mouse with left click on an empty region to move the camera
  • Scroll the mouse to zoom in/out
  • Press the space bar to pause/resume the simulation
  • Right click to place a planet
  • Click a planet to select it. It will turn gray.
  • Press +/- to increase/decrease the radius (and as a result, mass) of the selected planet
  • Press backspace to delete the selected planet
  • Drag a planet with left click to move it
  • Drag a planet with right click to set its velocity (Green lines indicate velocity)
  • Press ctrl + backspace to delete all planets

gravity-simulator's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.