Sign in to follow this  

Impulse based friction on line segment

This topic is 2113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Trying to figure out the friction impulse to apply on a circle rolling down a line segment, I've read a lot of other threads and it seems like it's kind of similar to the elastic impulse:

[code]
// nx & ny = contact normal
// fE = elastic impulse
// dx & dy = distance from center of mass to contact point

var tx = -ny;
var ty = nx;

var tCross = dx*ty-dy*tx;

var friction = .5;

var fF = tx*c.vx+ty*c.vy;
fF /= (c.inverseMass+(tCross*tCross)/c.momentOfInertia);

var fx = (fE*nx)+(friction*fF*tx);
var fy = (fE*ny)+(friction*fF*ty);

// xy velocity + angular

c.vx -= fx*c.inverseMass;
c.vy -= fy*c.inverseMass;

c.av -= (dx*fy-dy*fx)/c.momentOfInertia;
[/code]

This is following the same sort of "pattern" adapted for the angular force as the usual
j = -(1 + e)rV . n / (n . n(iM1) + (pv1 . n)^2 / I1)

However when it came to the implementation, the behaviour of it's a little.. strange. Here's a demo - http://www.fileize.com/view/9137d063-58a/
I've tried clamping the friction to be a limit based on the elastic impulse but that didn't really do much. Could anybody enlighten me as to where I've slipped up?

Share this post


Link to post
Share on other sites

This topic is 2113 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this