Understanding applyImpulse
Posted: Sun Mar 22, 2009 1:59 pm
I am trying to understand applyImpulse. I have circle shapes and I want to push them without adding any angular velocity. I thought if I just applied an impluse directly at their center, with the force vector being the direction I want them to move , they would do so. But they start spinning. On reading the boards, I see people talking about the force vector being in world co-ordinates vs object co-ordinates. My question is, how is the force vector in a co-ordinate system? Isn't it just X=horizontal component of the force and y=vertical, ie a force vector of 5,5 would be a northeast(in opengl) pushing force of strength 5?
Clearly I don't have this down quite right.
I also tried applying the impulse at a position which is shifted from the center by a inverse of the force vector * my radius but that didnt do it either.
Thoughts?
Updated, Ok I figured out what I was misunderstanding here I think. If somebody can correct me, the 2 vectors you pass are the start and end point of a line that represents the push on the object. The longer the line the bigger, and the point of impact of the line with the shape determines what happens as far as rotation vs velocity etc.
So the only question I have left now is whats the correct force to apply to a circle to make it rotate without making it move. I was trying vertical forces along the circles edge, kinda like a hand hitting a wheel to spin it, but it still gets bumped forward. Should I just hard set the angular momentum variable instead or is that not a good way to use this engine?
Great engine btw, thanks !
Clearly I don't have this down quite right.
I also tried applying the impulse at a position which is shifted from the center by a inverse of the force vector * my radius but that didnt do it either.
Thoughts?
Updated, Ok I figured out what I was misunderstanding here I think. If somebody can correct me, the 2 vectors you pass are the start and end point of a line that represents the push on the object. The longer the line the bigger, and the point of impact of the line with the shape determines what happens as far as rotation vs velocity etc.
So the only question I have left now is whats the correct force to apply to a circle to make it rotate without making it move. I was trying vertical forces along the circles edge, kinda like a hand hitting a wheel to spin it, but it still gets bumped forward. Should I just hard set the angular momentum variable instead or is that not a good way to use this engine?
Great engine btw, thanks !