I'm having difficulty understanding the offset parameter for the apply_force and apply_impulse functions. My body is roughly centered horizontally in the space. When I apply an upward impulse using an offset vector with a positive X component, my body seems to rotate left. If the vector has a negative X component, it seems to rotate right. This indicates to me that X=0 is likely the center of the space for offset world coordinates. This doesn't seem right; I expected it at the left.
Also, what does it mean if I apply an impulse with an offset that's nowhere near my body in world coordinates? It still seems to have an effect, but I'm not sure why.
Force/impulse offset coordinate system?
-
- Posts: 16
- Joined: Thu Nov 15, 2007 12:26 am
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Force/impulse offset coordinate system?
Looks like I have a typo in the documentation. The coordinates for the offset are in body local coordinates, not world coordinates. This means that the coordinates are ceneterd on the body, and rotates with it.
You can apply an impulse or force as far off center as you want. It has nothing to do with the shape of the object.
You can apply an impulse or force as far off center as you want. It has nothing to do with the shape of the object.
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: 16
- Joined: Thu Nov 15, 2007 12:26 am
- Contact:
Re: Force/impulse offset coordinate system?
Aha, things make sense with body local coordinates. World orientation for the force vector, body local coordinates for the offset vector. Thanks!
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Force/impulse offset coordinate system?
Ack. I forgot to update the docs on the site apparently. Also, I need to clear this up one more time...
The offset is in world space coordinates, but is relative to the center of gravity of the body. This means that an r of (0,2) will always be 2 units above the center of gravity in world space coordinates. The offset does not rotate with the body.
The offset is in world space coordinates, but is relative to the center of gravity of the body. This means that an r of (0,2) will always be 2 units above the center of gravity in world space coordinates. The offset does not rotate with the body.
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 15 guests