shogoki-vnz/CraftyBox2D

Sleep and Body Alignment

dlackey opened this issue · 2 comments

Sleep

If I allow the world to sleep and cause some entities' bodies to have a velocity of 0, they are unable to ever have a nonzero velocity after that point (although they can rotate).

Body Alignment

This may be more of a question. If I want to set an entity's origin to "center", how can I make its body also have an origin at its center?

Hi @dlackey , now you can pass a custom b2BodyDef for a more control in the body initialization. For the initial position you can use:

var customDef = new b2BodyDef; customDef.type = "dynamic"; customDef.position.Set(X, Y); craftyEntitie.box2d(bodyDef : customDef);

Just remember that the center of mass of the body is determined from mass distribution of the attached shapes

Check the Box2D manual for a complete review of all the options that you can use

Regards.

Thank you!

On Apr 26, 2013, at 9:39 AM, Jhean Ceballos notifications@github.com wrote:

Hi @dlackey , now you can pass a custom b2BodyDef for a more control in the body initialization. For the initial position you can use:

var customDef = new b2BodyDef;
customDef.type = "dynamic";
customDef.position.Set(X, Y);
craftyEntitie.box2d(bodyDef : customDef);

Just remember that the center of mass of the body is determined from mass distribution of the attached shapes

Check the Box2D manual for a complete review of all the options that you can use

Regards.


Reply to this email directly or view it on GitHub.