Page 1 of 1

Simulating QuickSand / Mud

Posted: Wed Oct 01, 2014 2:59 pm
by TheSwoit
Hi all,

I have a 2D Motorbike game, and I was wondering how I could simulate surfaces such as quicksand/mud.

I have a setup with a collision handler function where I just dampen all movement, but you are floating, so the wheels spinning do nothing.

I would like it to behave in a way in which it has friction with the spinning wheels, so you can drive out of it, but you sink if not moving fast enough.
Any ideas?
Thanks

Re: Simulating QuickSand / Mud

Posted: Tue Oct 14, 2014 2:50 pm
by TheSwoit
No ideas at all? Is this impossible in Chipmunk?
I'm sure I've seen it done.

Re: Simulating QuickSand / Mud

Posted: Fri Oct 17, 2014 6:47 pm
by slembcke
Hmm. I suppose you could emulate this with a collision pre-solve callback. It lets you override collision values in the cpArbiter each frame before the physics is solved. One of the things you can do is change the collision overlap distance to trick it into thinking the objects are overlapping less than they really are, allowing the object to sink into the surface. The other thing you would need to do is change the surface velocity to tell it that the quicksand's surface is moving downwards even though it's collision bounds aren't moving.

The "sticky" demo does some of what I'm describing. https://github.com/slembcke/Chipmunk2D/ ... icky.c#L41

Re: Simulating QuickSand / Mud

Posted: Sun Oct 19, 2014 11:46 am
by TheSwoit
Thanks Slembcke, I was using a Sensor, I will try with a shape and see if I can trick it somewhat.