private void GetRandomAABB(ref AABB aabb) { Vec2 w = new Vec2(); w.Set(k_width, k_width); aabb.LowerBound.X = Box2DXMath.Random(-_extent, _extent); aabb.LowerBound.Y = Box2DXMath.Random(0.0f, 2.0f * _extent); aabb.UpperBound = aabb.LowerBound + w; }
private void Action() { int choice = (int)Box2DXMath.Random(0, 2); switch (choice) { case 0: CreateProxy(); break; case 1: DestroyProxy(); break; default: MoveProxy(); break; } }
private void MoveAABB(ref AABB aabb) { Vec2 d = new Vec2(); d.X = Box2DXMath.Random(-0.5f, 0.5f); d.Y = Box2DXMath.Random(-0.5f, 0.5f); //d.x = 2.0f; //d.y = 0.0f; aabb.LowerBound += d; aabb.UpperBound += d; Vec2 c0 = 0.5f * (aabb.LowerBound + aabb.UpperBound); Vec2 min = new Vec2(); min.Set(-_extent, 0.0f); Vec2 max = new Vec2(); max.Set(_extent, 2.0f * _extent); Vec2 c = Box2DXMath.Clamp(c0, min, max); aabb.LowerBound += c - c0; aabb.UpperBound += c - c0; }