I may lack in physics lessons but I can't seem to understand what the "rel_pos" parameter of this function does ? A point inside the body where the impulse is applyed ?
And is there any other way of moving objects around ? I see that "applyForce" has the same "rel_pos" parameter that confuses me.
Body->applyImpulse question
-
- Posts: 36
- Joined: Fri Aug 25, 2006 1:00 am
- Location: Bucharest
-
- Posts: 127
- Joined: Sun Aug 13, 2006 4:41 pm
- Location: Cedar Hill, Texas
Re: Body->applyImpulse question
Yes - exactly. Take a cube - sliding on a plane for example. If you hit it with an impulse squarely in the center of a face, the cube will slide along in a straight line and slowly come to a halt under friction. If you hit it closer to one corner (with the same impulse) then it will spin around instead. The behavior is just exactly as if you put a brick on the floor and hit it with a hammer in different places.cippyboy wrote:I may lack in physics lessons but I can't seem to understand what the "rel_pos" parameter of this function does ? A point inside the body where the impulse is applyed ?
The parameter is called 'rel_pos' because it's the POSition RELative to the axes of the object - not the absolute position within the world coordinate system. So if you have a 1x1x1 cube with it's local origin at the center of the cube then repeatedly hitting it with an impulse at 0,-0.5,0 will make it slide in a straight line - no matter which way it's facing or where it is placed within the virtual world.