Page 1 of 1

Constant friction force

PostPosted: Tue Jan 03, 2012 10:01 pm
by Kilinich
It can be very useful for top view games like pool.
It's a script for circles with constant air friction (works with any custom air).

force (in Newtons) is adjusted via _frictionForce variable

Code: Select all
_frictionForce = 1;
airFrictionMult = {
    circle := readable(owner);
    v := circle.vel;
    u2 := (v(0) * v(0) + v(1) * v(1));
    u := u2 ^ 0.50000000;
    d := circle.radius * 2;
    ff := d * (Sim.airFrictionLinear * u + Sim.airFrictionQuadratic * u2);
    ff == 0 ? 1 : {owner._frictionForce / ff / Sim.airFrictionMultiplier}
}


Just put that code into circle's script window and it will behave like a hockey puck ;-)

Rating: rated 5.6
Filesize: 9.37 kB
Comments: 3
Ratings: 2
download

Re: Constant friction force

PostPosted: Sat Jan 07, 2012 5:51 pm
by davidz40
Great for top view car sims too.