If two shapes are using a same body, then how will we set the position of the body
body->p = shape1.position;
or
body->p = shape2.position;
How should I handle it
Position of body when two shapes using it
-
- Posts: 10
- Joined: Thu Dec 30, 2010 4:51 pm
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Position of body when two shapes using it
Shapes are always positioned relative to bodies. When the body moves, so will the shapes.
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: 10
- Joined: Thu Dec 30, 2010 4:51 pm
- Contact:
Re: Position of body when two shapes using it
Yes, shapes will be updated according to the position of body. But, Don't we have to give initial position of body.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Position of body when two shapes using it
The position of the body is the position of it's center of gravity. The shapes move and rotate around that.
So when you set the position of the body initially, you are setting it's center of gravity. The shapes attached are always relative to that.
So when you set the position of the body initially, you are setting it's center of gravity. The shapes attached are always relative to that.
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: 10
- Joined: Thu Dec 30, 2010 4:51 pm
- Contact:
Re: Position of body when two shapes using it
I got it, Thanks for your help
Who is online
Users browsing this forum: No registered users and 16 guests