Hello
I have a non gravity environment. Bodies need to move to a specific coordinate and there they should stop slowly or interpolate a bit around the point. I need to use applyforce because pivot needs to much performance. How to achieve this? I dont want to use resetForces. I think I need something like a brake.
Thank you
Reduce Velocity
-
- Posts: 5
- Joined: Thu Feb 13, 2014 5:33 am
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Reduce Velocity
Well, the general way to do that is to say that you want the object to move some fraction of the way to the target position within the next frame, say half way there. Then you figure out what velocity the object would need to be moving at in order to move to that position and what force you would need to accelerate to that velocity.
By adjusting the fraction, maximum allowed velocity and maximum force, you can get a pretty good behavior. This is quite close to what Chipmunk's joints are doing, but those are applied in a much more expensive way since they need to be solved as hard constraints.
By adjusting the fraction, maximum allowed velocity and maximum force, you can get a pretty good behavior. This is quite close to what Chipmunk's joints are doing, but those are applied in a much more expensive way since they need to be solved as hard constraints.
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: 5
- Joined: Thu Feb 13, 2014 5:33 am
- Contact:
Re: Reduce Velocity
How do I add maxforce and maxvelocity with applyForce?
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Reduce Velocity
Well, you don't. You have to calculate it all yourself. You apply a max velocity by not accelerating the body when it's already going fast enough, and max force by not setting the force value to a large value.
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: 5
- Joined: Thu Feb 13, 2014 5:33 am
- Contact:
Re: Reduce Velocity
Thanks. Do you mean by fraction, friction?
Is this also happening when the body doesnt touch any other object or floor? As its top down zero gravity.
Is this also happening when the body doesnt touch any other object or floor? As its top down zero gravity.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Reduce Velocity
Sorry, left this tab open on my iPad for like a week. :-\
I meant fraction, like a percentage.
I meant fraction, like a percentage.
Not sure I understand the question. This is how you would implement that.between 3 and 20 wrote:Is this also happening when the body doesnt touch any other object or floor? As its top down zero gravity
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: No registered users and 10 guests