I made a gravitational simulator and it is under public domain


#1

Very very simple, buggy and inefficient gravitation simulator. My first game in JMonkey Engine. You can move with ‘ASDW’ and shoot balls with left click. This will make life easier for those who want to create games set in space, astronomical and scientific simulations, teach physics by giving the program educational applications or simply have a good time playing and improving it through programming in JMonkey engine.
It is licensed under the Unlicense.

You can play it directly by opening MyGame.jar in the “dist” folder.


#2

Congratulations on unlocking this important achievement.

To help others discover your project, please tag it with topics such as jmonkeyengine3 and jme3.


#3

A big mistake was solved. I placed “Gravitation constant” when I had to place “Standard gravitational parameter” in the HUD.


#4

UPDATE TO THE NEW VERSION NOW !!!
I have fixed the formula of universal gravitation. Now you can put other more massive bodies and they will have the same trajectory as the less massive ones, as they should be. I had forgotten to place the mass of the rigid object in the formula. Until now, it worked well because the mass of each cannonball is 1, but if you placed your own rigid objects with different masses they followed different trajectories.

Sorry for the inconvenient. I know physics, but I’m still a beginner in JMonkeyEngine.


#5

I have solved a silly mistake. Instead of placing if (t % 60 == 0) in simpleUpdate I have placed if (t % 60 != 0). The idea behind it is that every 60 frames do the HUD again, and I did the opposite. The bug has been resolved.


#6

PSSSSTT!!! It is not mandatory but it would be appreciated for me and the community to notify here if they are working on a project based on this code. I say it just out of curiosity, I would like to know your project. :slight_smile:


#7

INFO:
This project is partially based on what this man did in Unity, which can also be found here (https://www.youtube.com/watch?v=Ouu3D_VHx9o&t=7s) and is also in the public domain (https://github.com/Brackeys/Gravity-Simulation-Tutorial/blob/master/Planet%20Gravity/Assets/Attractor.cs). I moved the logic here by reimplementing it in JMonkeyEngine, with the difference that here there is only one attractor point in (0, 0, 0) and I made the Attractor class for anyone who wants to complete it with rigid attractor bodies.