public override void Step(TestSettings settings) { bool advanceRay = settings.pause == false || settings.singleStep; base.Step(settings); m_debugDraw.DrawString("Press 1-5 to drop stuff"); float L = 25.0f; Vec2 point1 = new Vec2(0.0f, 10.0f); Vec2 d = new Vec2(L * (float)Math.Cos(m_angle), -L * Math.Abs((float)Math.Sin(m_angle))); Vec2 point2 = point1 + d; EdgeShapesCallback callback = new EdgeShapesCallback(); m_world.RayCast(callback, point1, point2); if (callback.m_fixture != null) { m_debugDraw.DrawPoint(callback.m_point, 5.0f, Color.FromArgb(100, 225, 100)); m_debugDraw.DrawSegment(point1, callback.m_point, Color.FromArgb(200, 200, 200)); Vec2 head = callback.m_point + 0.5f * callback.m_normal; m_debugDraw.DrawSegment(callback.m_point, head, Color.FromArgb(225, 225, 100)); } else { m_debugDraw.DrawSegment(point1, point2, Color.FromArgb(200, 200, 200)); } if (advanceRay) { m_angle += 0.25f * (float)Math.PI / 180.0f; } }
public override void Step(TestSettings settings) { bool advanceRay = settings.pause == false || settings.singleStep; base.Step(settings); m_debugDraw.DrawString("Press 1-5 to drop stuff"); float L = 25.0f; Vec2 point1 = new Vec2(0.0f, 10.0f); Vec2 d = new Vec2(L * (float)Math.Cos(m_angle), -L * Math.Abs((float)Math.Sin(m_angle))); Vec2 point2 = point1 + d; EdgeShapesCallback callback = new EdgeShapesCallback(); m_world.RayCast(callback, point1, point2); if (callback.m_fixture != null) { m_debugDraw.DrawPoint(callback.m_point, 5.0f, Color.FromArgb(100, 225, 100)); m_debugDraw.DrawSegment(point1, callback.m_point, Color.FromArgb(200, 200, 200)); Vec2 head = callback.m_point + 0.5f * callback.m_normal; m_debugDraw.DrawSegment(callback.m_point, head, Color.FromArgb(225, 225, 100)); } else { m_debugDraw.DrawSegment(point1, point2, Color.FromArgb(200, 200, 200)); } if (advanceRay) { m_angle += 0.25f * (float)Math.PI / 180.0f; } }