Spherical gravitation

Gravity is a vector that is normally directed down the y axis.

I am trying to simulate a gravity of a sun, in doing so I put random points on the surface of the sphere that point to the center and I use that as the graviation force, however it is not working and I can’t find the reason. Can anyone give me a hint?

bug, sun gravitation | Babylon.js Playground (babylonjs-playground.com)

With the help of GPT: a solution without the physics engine

bug, sun gravitation | Babylon.js Playground (babylonjs-playground.com)

I think that instead of using “gravity”, you can apply a force yourself.

bug, sun gravitation | Babylon.js Playground (babylonjs-playground.com)

3 Likes

What?!? :smiley:

I was looking for this solution, thank you!