Spooky Pooky #51 - Physics Again

Published on 04 May 2016 by Joe

Physics stuff is a funny beast .. I had buoyancy working ages ago, but after fixing a few seemingly innocent bugs I realised that I'd completely broken it ...

I can pop arbitrary chunks of tiles out as distinct entities by drawing a rectangular object around them in the level editor I'm using (Tiled) - I can then give them a few properties, such as density, which means that dropping into water will cause them to float. To do this I use a pretty standard buoyancy equations, but the thing that was really screwing it up was adding drag forces - for very light objects (such as those platforms, which have to be light so they don't sink when the player lands on them) I managed to give it massive drag forces in the reverse direction to velocity causing things to explode out of the water ..

For variable height jumping I've really been round the houses trying different things - and then the simplest thing worked, straight out of the Sonic handbook .. pretty much what you do I think - give the max impulse on jump and when the key is released then cap the y velocity at about 50% of the max power .. I was dubious but it works very well ..

Published on 04 May 2016 by Joe
Back to index