Skip to content
/ graty Public

This application simulates the effects of gravity from different planets on a bouncing ball. It provides a visual representation of how objects would behave under different gravitational conditions.

Notifications You must be signed in to change notification settings

AlanDavd/graty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Planetary Gravity Simulator

This application simulates the effects of gravity from different planets on a bouncing ball. It provides a visual representation of how objects would behave under different gravitational conditions.

Features

  • Simulate gravity effects from different planets (Earth, Moon, Mars, Venus, Mercury, and Jupiter)
  • Interactive bouncing ball simulation
  • Real-time planet selection
  • Reset functionality
  • Realistic physics simulation with elasticity

Requirements

  • Go 1.21 or later
  • Fyne toolkit dependencies

Installation

  1. Clone the repository:
git clone https://github.com/alandavd/graty.git
cd graty
  1. Install dependencies:
go mod tidy
  1. Run the application:
go run main.go

Usage

  1. Launch the application
  2. Select a planet from the dropdown menu to change the gravity simulation
  3. Watch the ball bounce with the selected planet's gravity
  4. Use the "Reset Ball" button to return the ball to its initial position

Physics Implementation

The simulation uses basic physics equations for gravity and elastic collisions:

  • Gravity acceleration is applied continuously to the ball
  • Elastic collisions are simulated with a coefficient of elasticity (0.7)
  • Time-step based animation at ~60 FPS

Planet Gravity Values

  • Earth: 9.81 m/s²
  • Moon: 1.62 m/s²
  • Mars: 3.72 m/s²
  • Venus: 8.87 m/s²
  • Mercury: 3.7 m/s²
  • Jupiter: 24.79 m/s²

About

This application simulates the effects of gravity from different planets on a bouncing ball. It provides a visual representation of how objects would behave under different gravitational conditions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages