schteppe / p2.js

JavaScript 2D physics library
Other
2.64k stars 329 forks source link

Top-view car friction constraint #122

Closed schteppe closed 9 years ago

schteppe commented 10 years ago

Would be cool to have a constraint that adds friction in the "sideways" direction of a body. This could be used to make a top-down-view racing car.

Maybe it would be useful to make a Vehicle helper class too.

Fishrock123 commented 10 years ago

Air friction? Yes please.

Fishrock123 commented 9 years ago

@schteppe is this only applicable to that specific type of body?

schteppe commented 9 years ago

@Fishrock123 It should work with any dynamic body.. I guess you want to use it for your spaceship game?

Fishrock123 commented 9 years ago

Maybe eventually, but I'm more just curious. I didn't look in the code in great detail, but it seemed more specific than something like just air friction.

schteppe commented 9 years ago

It's basically just a way to prevent sliding along a local axis. I'm sure it can be used for other things than just top down vehicles.

For example, it should be possible to implement Retry-like plane physics using this class.