I want to make a body to jump, but apply_force makes it act weird (it never slows down).
Is there a "proper way" to make the body jump? Or did I do the force applying wrong?
Make a body to jump?
-
- Posts: 19
- Joined: Mon Oct 06, 2008 7:50 am
- Contact:
-
- Posts: 157
- Joined: Mon Aug 20, 2007 12:53 pm
- Location: London, UK
- Contact:
Re: Make a body to jump?
Try applying an impulse instead.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Make a body to jump?
Forces act continuously until you reset them. Impulses modify the object's velocity immediately. Impulses are a much better way to implement things like jumping or guns firing.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 19
- Joined: Mon Oct 06, 2008 7:50 am
- Contact:
Re: Make a body to jump?
Ok thanks.
-
- Posts: 1
- Joined: Thu Oct 09, 2008 9:48 am
- Contact:
Re: Make a body to jump?
ok evrything is fine but what is r (some offset or what) and j (some vector of what ?) ?
Code: Select all
cpBodyApplyImpulse(cpBody *body, cpVect j, cpVect r)
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Make a body to jump?
Yeah, it's the shorthand used in all the physics equations. Someday I'll refactor all the naming to make it more clear. I swear
j is the impulse expressed as a vector in absolute coordinates. r is the offset from the center of gravity of the body, also expressed in absolute coordinates.
j is the impulse expressed as a vector in absolute coordinates. r is the offset from the center of gravity of the body, also expressed in absolute coordinates.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: Bing [Bot] and 12 guests