Skip to content
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

How to apply force to a body? #56

Open
x1911 opened this issue Aug 25, 2017 · 6 comments
Open

How to apply force to a body? #56

x1911 opened this issue Aug 25, 2017 · 6 comments

Comments

@x1911
Copy link

x1911 commented Aug 25, 2017

for example, i want a ball move to right side,

and i have tried to use body.applyImpulse ({
x:0, y:0, z:100
}, 10);

unfortunately it dosen't work.

BTW: how to make a ball jump in this case?

@w84miracle
Copy link

Forces are directional, hence your force should be a vector3 too.

applyImpulse: function(position, force){

@x1911
Copy link
Author

x1911 commented Aug 25, 2017

@w84miracle thanks for reply, have you some example to show how this works?

@x1911
Copy link
Author

x1911 commented Aug 25, 2017

has other way to apply force except body.applyImpulse ?
if i want to keep the gravity [0, 9.8 ,0]

@lo-th
Copy link
Owner

lo-th commented Aug 25, 2017

no look code in
http://lo-th.github.io/Oimo.js/#planet
you can keep gravity ;)

@lo-th
Copy link
Owner

lo-th commented Aug 25, 2017

maybe your impulse is no strong enouth to jump
i try a example soon

@icedcoke
Copy link

force in oimo needs to be updated in every frame. no update will not see the effect.
body.applyImpulse ({x:0, y:0, z:0}, {x:0, y:20, z:0});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants