lo-th / Oimo.js

Lightweight 3d physics engine for javascript
http://lo-th.github.io/Oimo.js
MIT License
3.05k stars 301 forks source link

Friction isn't properly handled? #25

Closed QuaziKb closed 8 years ago

QuaziKb commented 9 years ago

The coefficients of friction on objects don't seem to be affecting very much. Ideally a coefficient of zero would mean objects could slide freely over one another (like on ice), but it seems there is still a very considerable damping/frictional effect going on which prevents that kind of sliding behavior. Any ideas how i can go about fixing this?

EDIT: actually i found the problem, setting the coefficient of friction/restitution/etc to 0 means the checks when you create a new OIMO.Body() are seeing it as a falsey value and replacing it with the default of 0.4 in the case of friction.

should be replaced with (obj.config[1] === undefined ? 0.4 : obj.config[1]) etc. so 0 is a legal input, but the method of setting a default if a parameter is left out is preserved

lo-th commented 9 years ago

yes in javascript a value with 0 mean null and remplace with default i have to take care about that

you can use 0.001 for friction

lo-th commented 8 years ago

updated in dev