Shared.RenderData.CreatePhysics C# (CSharp) Method

CreatePhysics() private method

private CreatePhysics ( Midgard midgard, Entity entity, bool usePos = true ) : void
midgard Asgard.Core.Physics.Midgard
entity Entity
usePos bool
return void
        private void CreatePhysics(Midgard midgard, Entity entity, bool usePos = true)
        {
            var comp = midgard.CreateComponent(entity,
                            new BodyDefinition()
                            {
                                Position = usePos ? new Farseer.Framework.Vector2(18f + (float)rnd.Next(0, 4), 17f + (float)rnd.Next(0, 3)) :
                                new Farseer.Framework.Vector2(0, 0)
                            });

            Vertices rectangleVertices = PolygonTools.CreateRectangle(0.5f, 0.2f,
                new Farseer.Framework.Vector2(0f, 0.4f), 0f);
            PolygonShape shape = new PolygonShape(rectangleVertices, 10000f);
            var fix = comp.Body.CreateFixture(shape);
            comp.Body.FixedRotation = true;
            comp.Body.Mass = 1000f;
            comp.Body.Restitution = 1f;
            comp.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat2;
            comp.Body.CollidesWith = FarseerPhysics.Dynamics.Category.Cat1;
        }