Simulating QuickSand / Mud

Official forum for the Chipmunk2D Physics Library.

Simulating QuickSand / Mud

Postby TheSwoit » Wed Oct 01, 2014 2:59 pm

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

Re: Simulating QuickSand / Mud

Postby TheSwoit » Tue Oct 14, 2014 2:50 pm

No ideas at all? Is this impossible in Chipmunk?
I'm sure I've seen it done.
TheSwoit
 
Posts: 3
Joined: Wed Oct 01, 2014 2:50 pm

Re: Simulating QuickSand / Mud

Postby slembcke » Fri Oct 17, 2014 6:47 pm

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/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Simulating QuickSand / Mud

Postby TheSwoit » Sun Oct 19, 2014 11:46 am

Thanks Slembcke, I was using a Sensor, I will try with a shape and see if I can trick it somewhat.
TheSwoit
 
Posts: 3
Joined: Wed Oct 01, 2014 2:50 pm


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 5 guests

cron