I am new to physicsjs and am creating some test simulations in order to become familiar with the library.
I want to simulate multiple boxes sliding across the screen which all experience different degrees of friction. So far I have 3 boxes which start on the left border of the screen and all have a pos xvel. I am unsure what the best approach is to add friction to the simulation. all 3 boxes should not be affected the same way by friction. Therefor i need some way of applying a general friction algorithm to all the boxs, however the amount of friction needs to depend on what box it is currently acting on.
Friction is built in (but it's not the greatest algorithm).
Just use:
Physics.body('rectangle', {
width: 40,
height: 40,
cof: 0.5, // <-- change the friction. range [0, 1]
x: ...
...
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With