-
Notifications
You must be signed in to change notification settings - Fork 711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why don't any of the examples use applyForce / applyImpulse? #257
Comments
If you run applyForce or applyImpulse, it will add to |
ah ok, thanks! |
On these lines of the FPS demo,
Isn't that the same as |
Yeah, it is! But applyImpulse can add angular velocity too, depending on where you apply the impulse. |
I think many a newbie has tried to jump into this library and been confused at not understanding how to apply forces. The use of velocity directly is far more predictable than applyImpulse, which makes more sense for programatic use generally. See [here](schteppe/cannon.js#257) for some validation of what I'm talking about, though I think it's also something easy to experience if you try creating a demo following this readme, and may lead to poor initial user experiences with CANNON, as described e.g. [here](https://aframevr.slack.com/archives/C3WGUL4K0/p1617736493000900). Perhaps some glitch demos should be shared here that would be a bit easier to digest for beginners as well?
I think many a newbie has tried to jump into this library and been confused at not understanding how to apply forces. The use of velocity directly is far more predictable than applyImpulse, which makes more sense for programatic use generally. See [here](schteppe/cannon.js#257) for some validation of what I'm talking about, though I think it's also something easy to experience if you try creating a demo following this readme, and may lead to poor initial user experiences with CANNON, as described e.g. [here](https://aframevr.slack.com/archives/C3WGUL4K0/p1617736493000900). Perhaps some glitch demos should be shared here that would be a bit easier to digest for beginners as well?
I'm trying to debug my jumping code (as mentioned on Twitter) and when looking at the FPS example code, http://schteppe.github.io/cannon.js/examples/js/PointerLockControls.js, to make the player jump, the velocity property of the body is mutated directly:
Why do you do this instead of using
applyForce
orapplyImpulse
? Are those innappropriate to use for applying movement forces to a player?The text was updated successfully, but these errors were encountered: