当前位置: 首页>>代码示例>>C#>>正文


C# Geom.IgnoreCollisionWith方法代码示例

本文整理汇总了C#中Geom.IgnoreCollisionWith方法的典型用法代码示例。如果您正苦于以下问题:C# Geom.IgnoreCollisionWith方法的具体用法?C# Geom.IgnoreCollisionWith怎么用?C# Geom.IgnoreCollisionWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Geom的用法示例。


在下文中一共展示了Geom.IgnoreCollisionWith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadContent

        public override void LoadContent()
        {
            bodyA = BodyFactory.Instance.CreateRectangleBody(100, 25, 5);
            bodyB = BodyFactory.Instance.CreateRectangleBody(100, 25, 5);

            bodyA.Position = new Vector2(250, 300);
            bodyB.Position = new Vector2(350, 300);

            geomA = GeomFactory.Instance.CreateRectangleGeom(bodyA, 100, 25);
            geomB = GeomFactory.Instance.CreateRectangleGeom(bodyB, 100, 25);
            geomA.IgnoreCollisionWith(geomB);

            weldJoint = new WeldJoint(bodyA, bodyB, new Vector2(300, 300));
            weldJoint.Broke += weldJoint_Broke;
            weldJoint.Breakpoint = 5.0f;

            PhysicsSimulator.Add(bodyA);
            PhysicsSimulator.Add(bodyB);
            PhysicsSimulator.Add(geomA);
            PhysicsSimulator.Add(geomB);
            PhysicsSimulator.Add(weldJoint);

            brush = new PolygonBrush(Vertices.CreateRectangle(100, 25), Color.White, Color.Black, 2.0f, 0.5f);

            brush.Load(ScreenManager.GraphicsDevice);

            bodyC = BodyFactory.Instance.CreatePolygonBody(Vertices.CreateGear(50, 20, .50f, 10), 10);
            bodyC.Position = new Vector2(500, 200);

            geomC = GeomFactory.Instance.CreatePolygonGeom(bodyC, Vertices.CreateGear(50, 20, .50f, 10), 1.5f);

            bodyD = BodyFactory.Instance.CreatePolygonBody(Vertices.CreateGear(50, 20, .50f, 10), 10);
            bodyD.Position = new Vector2(613, 200);

            geomD = GeomFactory.Instance.CreatePolygonGeom(bodyD, Vertices.CreateGear(50, 20, .50f, 10), 1.5f);

            geomC.CollisionGroup = 2;
            geomD.CollisionGroup = 3;
            geomC.FrictionCoefficient = 0f;
            geomD.FrictionCoefficient = 0f;

            PhysicsSimulator.Add(bodyC);
            PhysicsSimulator.Add(geomC);
            PhysicsSimulator.Add(bodyD);
            PhysicsSimulator.Add(geomD);

            gearBrushA = new PolygonBrush(Vertices.CreateGear(50, 20, .50f, 10), Color.White, Color.Black, 0.5f, 0.5f);

            gearBrushA.Load(ScreenManager.GraphicsDevice);

            gearBrushB = new PolygonBrush(Vertices.CreateGear(50, 20, .50f, 10), Color.White, Color.Black, 0.5f, 0.5f);

            gearBrushB.Load(ScreenManager.GraphicsDevice);

            revJointA = JointFactory.Instance.CreateFixedRevoluteJoint(bodyC, bodyC.Position);
            revJointB = JointFactory.Instance.CreateFixedRevoluteJoint(bodyD, bodyD.Position);

            PhysicsSimulator.Add(revJointA);
            PhysicsSimulator.Add(revJointB);

            table = new List<Table>();

            table.Add(new Table(new Vector2(200, 450), 200, 50));

            table[0].Load(PhysicsSimulator, ScreenManager.GraphicsDevice);

            base.LoadContent();
        }
开发者ID:rbrother,项目名称:seikkailulaakso,代码行数:68,代码来源:Demo10Screen.cs


注:本文中的Geom.IgnoreCollisionWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。