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


C# World.CreateBody方法代码示例

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


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

示例1: BreakableBody

        public BreakableBody(List<Vertices> vertices, World world, float density)
        {
            _world = world;
            MainBody = _world.CreateBody();
            MainBody.BodyType = BodyType.Dynamic;

            foreach (Vertices part in vertices)
            {
                PolygonShape polygonShape = new PolygonShape(part);
                Fixture fixture = MainBody.CreateFixture(polygonShape, density);
                fixture.PostSolve += PostSolve;
                Parts.Add(fixture);
            }
        }
开发者ID:HaKDMoDz,项目名称:Lunar-Development-Kit,代码行数:14,代码来源:BreakableBody.cs

示例2: CreateBody

 public static Body CreateBody(World world, Vector2 position)
 {
     Body body = world.CreateBody();
     body.Position = position;
     return body;
 }
开发者ID:scastle,项目名称:Solitude,代码行数:6,代码来源:BodyFactory.cs

示例3: EvenlyDistibuteShapesAlongPath

        /// <summary>
        /// Duplicates the given Body along the given path for approximatly the given copies.
        /// </summary>
        /// <param name="world">The world.</param>
        /// <param name="path">The path.</param>
        /// <param name="shapes">The shapes.</param>
        /// <param name="type">The type.</param>
        /// <param name="copies">The copies.</param>
        /// <returns></returns>
        public static List<Body> EvenlyDistibuteShapesAlongPath(World world, Path path, IEnumerable<Shape> shapes,
            BodyType type, int copies, float density)
        {
            List<Vector3> centers = path.SubdivideEvenly(copies);
            List<Body> bodyList = new List<Body>();

            Body b;

            for (int i = 0; i < centers.Count; i++)
            {
                b = world.CreateBody();
                // copy the type from original body
                b.BodyType = type;
                b.Position = new Vector2(centers[i].X, centers[i].Y);
                b.Rotation = centers[i].Z;

                foreach (Shape shape in shapes)
                {
                    b.CreateFixture(shape, density);
                }

                bodyList.Add(b);
            }

            return bodyList;
        }
开发者ID:seankruer,项目名称:eecs-290-super-power-robots,代码行数:35,代码来源:PathManager.cs


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