Simulating QuickSand / Mud

Official forum for the Chipmunk2D Physics Library.
Post Reply
TheSwoit
Posts: 3
Joined: Wed Oct 01, 2014 2:50 pm
Contact:

Simulating QuickSand / Mud

Post 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
TheSwoit
Posts: 3
Joined: Wed Oct 01, 2014 2:50 pm
Contact:

Re: Simulating QuickSand / Mud

Post by TheSwoit »

No ideas at all? Is this impossible in Chipmunk?
I'm sure I've seen it done.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Simulating QuickSand / Mud

Post 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
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
TheSwoit
Posts: 3
Joined: Wed Oct 01, 2014 2:50 pm
Contact:

Re: Simulating QuickSand / Mud

Post by TheSwoit »

Thanks Slembcke, I was using a Sensor, I will try with a shape and see if I can trick it somewhat.
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests