Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Dynamic friction 2D rigid body

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 cluelessWanderer   Members   

111
Like
0Likes
Like

Posted 06 October 2012 - 08:51 PM

I've looked at Chris heckers columns on rigid body physics and was able to implement a frictionless rigid body simulation,however, now I'm looking to implement dynamic friction.Unfortunately there doesn't seem to be alot of information available on how to achieve this on the net or maybe I haven't been looking hard enough. In any case I've come here to ask for assistance on how to achieve dynamic friction in my 2D rigid body simulation.

Here's a temporary clip of what the simulation looks like currently:


#2 luca-deltodesco   Members   

637
Like
0Likes
Like

Posted 07 October 2012 - 01:58 AM

Apart from the usual: use a physics engine. I'll assume you're doing this out of interest in learning, in which case I'd recommend looking at box2dlite and erin-catto's presentations (available on box2d.googlecode.com) which will also help you deal with resting contacts (no jittering the way you have)

#3 wildbunny   Members   

550
Like
1Likes
Like

Posted 07 October 2012 - 11:50 AM

First of all you'll need an equation which lets you remove velocity in one dimension via an impulse. If you have frictionless collision resolution working already, you have this equation to hand (you're using it to remove velocity in the contact normal direction).

So, next step is to find the velocity component in the tangential direction that you want to remove to create friction.

* Form the tangent vector using the perp operator on the contact normal
* Get the relative tangential velocity by dotting total relative contact point velocity against the tangent vector
* Now, you can then generate an impulse to remove some or all of this tangential velocity (most text books say the magnitude of this impulse should be bounded by the magnitude of the normal impulse, but if you just want infinite friction, remove the whole lot)

Job done Posted Image

Edited by wildbunny, 07 October 2012 - 11:51 AM.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.