Open zfreiberg opened 9 years ago
This should be pretty easy, right?
Hmm. It's worth discussing, certainly.
On the plus side, a gravity property would be compatible with other sources of acceleration in a simulation.
On the minus side, under most circumstances it would simply be a second acceleration term, adding to the computational cost of the component. Gravity is an acceleration, after all; and there aren't many use cases for ArcadePhysics
where you need to accelerate something in a non-gravitational context. Perhaps a situation where you're launching rockets in a gravity well with realistic acceleration? Under most use cases, you'd simply give an object an initial velocity and put gravity into the extant acceleration property.
The purpose of ArcadePhysics
is to provide a simple, low-cost physics simulation. The Chipmunk Physics plugin provides more in-depth simulations. There are certainly cases for a middle ground simulation which isn't as heavy as Chipmunk, but offers more options than Arcade; but this might be better implemented on a per-game basis.
Anybody else have thoughts on the matter?
Ideally this property would be a point ( or vector2 but I think we use points ) which would allow for gravity on all axis.
example of use:
this.spaceship.physics.gravity.x = 10;