Gravity without plugin

How to use gravity without a plugin?

I kind of did, but it seems to be too heavy, I don’t know why

Plugins like havok, cannon, add a significant amount of size to the project for such a small thing: Just force the meshes down

It’s like using jQuery just to do a fetch :neutral_face:

Does anyone know a better way to do this?

For a falling object, the vertical position under the influence of gravity can be calculated using:
y = y + v * time + 0.5 * gravity * time * time

where y is the starting vertical position, v is the initial vertical velocity, gravity obvious, time overall time.

Minimalistic PG:

2 Likes

Where is the mass and the density in the formula? :slight_smile:

Particle Sandbox - Gravity Simulator

1 Like

1 Like

Good point. I refrained from applying any formula. And I used moveWithCollisions wrong in this hasty playground.

Works fine like you did without moveWithCollisions

My problem is with the performance of moveWithCollisions.

Any way I apply moveWithCollisions to force gravity (-y) on many meshes (10), my GPU go BRRR!

Even with larger intervals:

It will be in the next merge request :upside_down_face: