Git Product home page Git Product logo

gravity-simulator's Introduction

Gravity-Simulator

About:

  • A simple program which can display and simulate the gravity and interactions between multiple objects.

image

Classes:

  • Vector2: stores all positions, directions and contains some basic 2d vector math methods.
  • UI: manages all graphics and user input
  • PhysicsObject: contains methods which calculate gravity and collisions, as well as containing methods for adding force to an object.

Making changes:

  • If you wish to make changes, simply edit the code in the main method located in GameManager.java.
  • To add more physics objects, one can choose to call one or more of the following constructors: `PhysicsObject() PhysicsObject(Vector2 position, double mass) PhysicsObject(Vector2 position, double mass, boolean isKinematic, boolean freezeRot, boolean effectedByGrav, boolean graviational, boolean collisions)
  • To add forces to the desired physics objects, use the addForce() method: `[physicsObject].addForce(new Vector2(x, y), 1);
  • To change speed of time, edit the "timescale" variable in GameManager.java
  • To change the FPS, modify the "FPS" final int in UI.java

gravity-simulator's People

Contributors

krishayb avatar trrt-good avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.