w0rm / elm-physics

3D physics engine in Elm
https://package.elm-lang.org/packages/w0rm/elm-physics/latest
BSD 3-Clause "New" or "Revised" License
146 stars 12 forks source link

Unexpected default behavior for Body #99

Open MartinSStewart opened 4 years ago

MartinSStewart commented 4 years ago

I created a physics simulation and ran it but it appeared to be frozen. I lost a few minutes before realizing that bodies default to the static behavior. Maybe it would make more sense if defining a body always requires you to explicitly choose a behavior instead?

w0rm commented 4 years ago

@MartinSStewart I like this suggestion! It is more in line with the elm-3d-scene and elm-geometry API. Also it seems easier to calculate everything during the construction because the total mass is known. Do you think that we need to be able to change the mass after the body is created?

I actually think that @ianmackenzie already suggested this to me before. Will definitely consider for the next major release.

MartinSStewart commented 4 years ago

I guess there might be use cases where the mass can change. Perhaps a "ground pound" move in a physics based fighting game would involve increasing the mass of a body before it hits the ground. Or something like Katamari where a sphere accumulates mass as it rolls over other physics objects.