Pay for Hesitation: box2dAs3

Pages

顯示具有 box2dAs3 標籤的文章。 顯示所有文章
顯示具有 box2dAs3 標籤的文章。 顯示所有文章

2010年10月18日 星期一

Objects Sliding on Horizontal Floor (As if there is no friction)

http://www.box2d.org/forum/viewtopic.php?f=4&t=66
Right, there is no rolling friction in Box2D. I can certainly add this. I can also add linear/angular damping. I think I'll do the latter first. For now you can just multiply the linear/angular velocity by a number slightly less than 1 each time step (like 0.95). You can also generate some energy loss by reducing the friction. Then the circles will slide a bit more and slow down, instead of sticking and rolling.


I finally solved this problem by using b2Body.SetLinearDamping() 



Why Dynamic Bodies Are Never Sleeping in Box2D World ?

What's the fucking bug!!


http://www.box2d.org/forum/viewtopic.php?f=3&t=3501
I figured out why they aren't sleeping. If gravity is greater than 60 then the bodies wont sleep. With 2.0.1 bodies will sleep with gravity as high as 100. The same issue manifests for setting forces directly to objects.

2010年8月17日 星期二

Iterate All Bodies in the Box2d World

2010年7月14日 星期三

Box2dAS3 Notes

Some weirdness to the b2ContactListener:
Problem: You can't alter your physics world from any function inside the contact listener.
Answer: Sometimes I like to set a flag and deal with the effects later.

Problem: The same contact might get called twice.
Answer: Not a big deal, just make a plan for it. Again, maybe a good reason to set a flag and deal with it later.