Force value issue
- CocoaGeek
- Posts: 18
- Joined: Thu Aug 27, 2009 10:32 am
- Contact:
Force value issue
Hello,
I'm running into a bit of a weird issue tonight. I'm trying to lift a body from a surface (static body) by applying a force to it.
Since I'm using real-world value (and SI units), I'm expecting the value for the force (in Newton) to need to be greater than Mass * Gravity in order to cancel the action of gravity and lift the body. However, what I'm seeing is that I need to multiply the force by 4, for it to have the expected effect.
The same issue manifest it-self if I set the body high above the surface. The body will only stay stationary if the lift force is multiplied by 4.
Any idea of what could be wrong? I'm probably doing something stupid, but I can't seems to see what exactly could cause this ...
Thanks in advance.
I'm running into a bit of a weird issue tonight. I'm trying to lift a body from a surface (static body) by applying a force to it.
Since I'm using real-world value (and SI units), I'm expecting the value for the force (in Newton) to need to be greater than Mass * Gravity in order to cancel the action of gravity and lift the body. However, what I'm seeing is that I need to multiply the force by 4, for it to have the expected effect.
The same issue manifest it-self if I set the body high above the surface. The body will only stay stationary if the lift force is multiplied by 4.
Any idea of what could be wrong? I'm probably doing something stupid, but I can't seems to see what exactly could cause this ...
Thanks in advance.
- CocoaGeek
- Posts: 18
- Joined: Thu Aug 27, 2009 10:32 am
- Contact:
Re: Force value issue
Hmmm ... Anyone else using real world values?
-
- Posts: 90
- Joined: Tue Aug 04, 2009 9:53 am
- Contact:
Re: Force value issue
I have not had this issue, I'm almost positive that to cancel gravity I've just done an equal and opposing force of gravity *mass..... could it have something to with where you applied the force on the body, I've always done it on the center of gravity.... or perhaps your calculated moment is wrong.... I'm just stabbing in the dark i'm in no way positive if that would even affect anything having to do with this issue.
- CocoaGeek
- Posts: 18
- Joined: Thu Aug 27, 2009 10:32 am
- Contact:
Re: Force value issue
Thanks for the reply I have tried to apply the force directly on the center of gravity (it was applied with a Y offset) and also changed the inertia value of the one of the disc of the same weight, but no change whatsoever
Could it be that I have expressed the gravity incorrectly? I specified it in m/s (e.g (0.0f,-9.8f) )
Could it be that I have expressed the gravity incorrectly? I specified it in m/s (e.g (0.0f,-9.8f) )
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Force value issue
I forgot my Macbook's power supply at the place we do contracting at so I can't really try anything out right now, but it should work just fine...
The integration just calculates the acceleration like so:
So if g=-f/m, then f = -g*m. Not exactly sure why that wouldn't be working.
The integration just calculates the acceleration like so:
Code: Select all
cpvadd(gravity, cpvmult(body->f, body->m_inv)
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/
- CocoaGeek
- Posts: 18
- Joined: Thu Aug 27, 2009 10:32 am
- Contact:
Re: Force value issue
Thanks Scott, I can wait a few days until you get your power supply back
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Force value issue
The following works for me:
Are you sure you aren't changing the gravity or mass after setting the force?
Code: Select all
ballBody->f = cpvmult(space->gravity, -ballBody->m);
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/
- CocoaGeek
- Posts: 18
- Joined: Thu Aug 27, 2009 10:32 am
- Contact:
Re: Force value issue
Yeah ... The only think I do, and don't think it's an issue, is to reset all the forces applied to all bodies after each time step. Could that be the issue?
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Force value issue
No, that should be fine.
You should check some of the values in cpBodyUpdateVelocity() in the debugger. The following should evaluate to zero unless something is very wrong:
You should check some of the values in cpBodyUpdateVelocity() in the debugger. The following should evaluate to zero unless something is very wrong:
cpvadd(gravity, cpvmult(body->f, body->m_inv)
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/
- CocoaGeek
- Posts: 18
- Joined: Thu Aug 27, 2009 10:32 am
- Contact:
Re: Force value issue
Will do, thanks for the suggestion(s).
Who is online
Users browsing this forum: No registered users and 13 guests