public override void Update(GameSettings settings, GameTime gameTime) { DrawString("Use the mouse to create a polygon."); DrawString("Simple: " + _vertices.IsSimple()); DrawString("Convex: " + _vertices.IsConvex()); DrawString("CCW: " + _vertices.IsCounterClockWise()); DrawString("Area: " + _vertices.GetArea()); PolygonError returnCode = _vertices.CheckPolygon(); if (returnCode == PolygonError.NoError) DrawString("Polygon is supported in Velcro Physics"); else DrawString("Polygon is NOT supported in Velcro Physics. Reason: " + returnCode); DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View); for (int i = 0; i < _vertices.Count; i++) { Vector2 currentVertex = _vertices[i]; Vector2 nextVertex = _vertices.NextVertex(i); DebugView.DrawPoint(currentVertex, 0.1f, Color.Yellow); DebugView.DrawSegment(currentVertex, nextVertex, Color.Red); } DebugView.DrawPoint(_vertices.GetCentroid(), 0.1f, Color.Green); AABB aabb = _vertices.GetAABB(); DebugView.DrawAABB(ref aabb, Color.HotPink); DebugView.EndCustomDraw(); base.Update(settings, gameTime); }
public override void Update(FarseerPhysicsGameSettings settings) { DebugView.DrawAABB(ref _terrainArea, Color.Red * 0.5f); DrawString("Left click and drag the mouse to destroy terrain!"); DrawString("Right click and drag the mouse to create terrain!"); DrawString("Middle click to create circles!"); DrawString("Press t or y to cycle between decomposers: " + _terrain.Decomposer); TextLine += 25; DrawString("Press g or h to decrease/increase circle radius: " + _circleRadius); base.Update(settings); }
public override void Update(GameSettings settings, GameTime gameTime) { DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View); DebugView.DrawAABB(ref _terrainArea, Color.Red * 0.5f); DebugView.EndCustomDraw(); DrawString("Left click and drag the mouse to destroy terrain!"); DrawString("Right click and drag the mouse to create terrain!"); DrawString("Middle click to create circles!"); DrawString("Press t or y to cycle between decomposers: " + _terrain.Decomposer); TextLine += 25; DrawString("Press g or h to decrease/increase circle radius: " + _circleRadius); base.Update(settings, gameTime); }
private void DrawTree(QuadTree <FixtureProxy> tree) { if (tree == null) { return; } DebugView.DrawAABB(ref tree.Span, Color.Yellow); if (tree.IsPartitioned) { foreach (QuadTree <FixtureProxy> quadTree in tree.SubTrees) { DrawTree(quadTree); } } }
public override void Update(FarseerPhysicsGameSettings settings) { DrawString("Use the mouse to create a polygon."); DrawString("Simple: " + _vertices.IsSimple()); DrawString("Convex: " + _vertices.IsConvex()); DrawString("CCW: " + _vertices.IsCounterClockWise()); DrawString("Area: " + _vertices.GetArea()); PolygonError returnCode = _vertices.CheckPolygon(); if (returnCode == PolygonError.NoError) { DrawString("Polygon is supported in Farseer Physics Engine"); } else { DrawString("Polygon is NOT supported in Farseer Physics Engine. Reason: " + returnCode); } for (int i = 0; i < _vertices.Count; i++) { Vector2 currentVertex = _vertices[i]; Vector2 nextVertex = _vertices.NextVertex(i); DebugView.DrawPoint(currentVertex, 0.1f, Color.Yellow); DebugView.DrawSegment(currentVertex, nextVertex, Color.Red); } DebugView.DrawPoint(_vertices.GetCentroid(), 0.1f, Color.Green); AABB aabb = _vertices.GetAABB(); DebugView.DrawAABB(ref aabb, Color.HotPink); base.Update(settings); }
public override void Update(GameSettings settings, GameTime gameTime) { _rayActor = null; for (int i = 0; i < ActorCount; ++i) { _actors[i].Fraction = 1.0f; _actors[i].Overlap = false; } if (_automated) { int actionCount = Math.Max(1, ActorCount >> 2); for (int i = 0; i < actionCount; ++i) { Action(); } } Query(); RayCast(); DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View); for (int i = 0; i < ActorCount; ++i) { Actor actor = _actors[i]; if (actor.ProxyId == -1) { continue; } Color ca = new Color(0.9f, 0.9f, 0.9f); if (actor == _rayActor && actor.Overlap) { ca = new Color(0.9f, 0.6f, 0.6f); } else if (actor == _rayActor) { ca = new Color(0.6f, 0.9f, 0.6f); } else if (actor.Overlap) { ca = new Color(0.6f, 0.6f, 0.9f); } DebugView.DrawAABB(ref actor.AABB, ca); } Color c = new Color(0.7f, 0.7f, 0.7f); DebugView.DrawAABB(ref _queryAABB, c); DebugView.DrawSegment(_rayCastInput.Point1, _rayCastInput.Point2, c); Color c1 = new Color(0.2f, 0.9f, 0.2f); Color c2 = new Color(0.9f, 0.2f, 0.2f); DebugView.DrawPoint(_rayCastInput.Point1, 0.1f, c1); DebugView.DrawPoint(_rayCastInput.Point2, 0.1f, c2); if (_rayActor != null) { Color cr = new Color(0.2f, 0.2f, 0.9f); Vector2 p = _rayCastInput.Point1 + _rayActor.Fraction * (_rayCastInput.Point2 - _rayCastInput.Point1); DebugView.DrawPoint(p, 0.1f, cr); } DebugView.EndCustomDraw(); int height = _tree.Height; DrawString("Dynamic tree height = " + height); }
public override void Update(GameSettings settings, GameTime gameTime) { //B2_NOT_USED(settings); _rayActor = null; for (int i = 0; i < _actorCount; ++i) { _actors[i].fraction = 1.0f; _actors[i].overlap = false; } if (_automated) { int actionCount = MathUtils.Max(1, _actorCount >> 2); for (int i = 0; i < actionCount; ++i) { Action(); } } Query(); RayCast(); DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View); for (int i = 0; i < _actorCount; ++i) { Actor actor = _actors[i]; if (actor.proxyId == DynamicTree <Actor> .NullNode) { continue; } Color c = new Color(0.9f, 0.9f, 0.9f); if (actor == _rayActor && actor.overlap) { c = new Color(0.9f, 0.6f, 0.6f); } else if (actor == _rayActor) { c = new Color(0.6f, 0.9f, 0.6f); } else if (actor.overlap) { c = new Color(0.6f, 0.6f, 0.9f); } DebugView.DrawAABB(ref actor.aabb, c); } { Color c = new Color(0.7f, 0.7f, 0.7f); DebugView.DrawAABB(ref _queryAABB, c); DebugView.DrawSegment(_rayCastInput.Point1, _rayCastInput.Point2, c); } Color c1 = new Color(0.2f, 0.9f, 0.2f); Color c2 = new Color(0.9f, 0.2f, 0.2f); DebugView.DrawPoint(_rayCastInput.Point1, 6.0f, c1); DebugView.DrawPoint(_rayCastInput.Point2, 6.0f, c2); if (_rayActor != null) { Color cr = new Color(0.2f, 0.2f, 0.9f); Vector2 p = _rayCastInput.Point1 + _rayActor.fraction * (_rayCastInput.Point2 - _rayCastInput.Point1); DebugView.DrawPoint(p, 6.0f, cr); } { int height = _tree.Height; DrawString("dynamic tree height = " + height); } DebugView.EndCustomDraw(); ++_stepCount; base.Update(settings, gameTime); }
public override void Update(FarseerPhysicsGameSettings settings) { _rayActor = null; for (int i = 0; i < ActorCount; ++i) { _actors[i].Fraction = 1.0f; _actors[i].Overlap = false; } if (_automated) { int actionCount = Math.Max(1, ActorCount >> 2); for (int i = 0; i < actionCount; ++i) { Action(); } } Query(); RayCast(); for (int i = 0; i < ActorCount; ++i) { Actor actor = _actors[i]; if (actor.ProxyId == -1) { continue; } Color ca = new ColorR(0.9, 0.9, 0.9); if (actor == _rayActor && actor.Overlap) { ca = new ColorR(0.9, 0.6, 0.6); } else if (actor == _rayActor) { ca = new ColorR(0.6, 0.9, 0.6); } else if (actor.Overlap) { ca = new ColorR(0.6, 0.6, 0.9); } DebugView.DrawAABB(ref actor.AABB, ca); } Color c = new ColorR(0.7, 0.7, 0.7); DebugView.DrawAABB(ref _queryAABB, c); DebugView.DrawSegment(_rayCastInput.Point1, _rayCastInput.Point2, c); Color c1 = new ColorR(0.2, 0.9, 0.2); Color c2 = new ColorR(0.9, 0.2, 0.2); DebugView.DrawPoint(_rayCastInput.Point1, 0.1f, c1); DebugView.DrawPoint(_rayCastInput.Point2, 0.1f, c2); if (_rayActor != null) { Color cr = new ColorR(0.2f, 0.2f, 0.9f); Vector2 p = _rayCastInput.Point1 + _rayActor.Fraction * (_rayCastInput.Point2 - _rayCastInput.Point1); DebugView.DrawPoint(p, 0.1f, cr); } int height = _tree.Height; DrawString("Dynamic tree Height = " + height); }