Tuesday, April 7, 2009

How to change color of BOX2D objects

Well for changing box2d color you need to edit file b2World.as in BOX2D/Dynamics

In about 1060 line number


for (s = b.GetShapeList(); s; s = s.m_next)
{
if (b.IsStatic())
{
DrawShape(s, xf, new b2Color(1, 1,1), core);
}
else if (b.IsSleeping())
{
DrawShape(s, xf, new b2Color(0.0, 0.0, 0.9), core);
}
else
{
DrawShape(s, xf, new b2Color(0.8, 0.7, 0.5), core);
}
}

change the values in new b2Color(0.4, 0.4,1) to change the color

No comments:

Post a Comment