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


C# World.AddBody方法代码示例

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


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

示例1: PopulateWorld

        public void PopulateWorld(World w) {


            foreach (Body b in bodyList) {
                
                b.setWorld(w);

                foreach (Fixture f in b.FixtureList)
                {
                    f.Shape.ComputeProperties();
                    w.FixtureAdded(f);
                }

                float mass = b.Mass;
                //b.ResetMassData();
                b.Mass = mass;
                b.Enabled = true;
                b.Awake = true;
                w.AddBody(b); 
                //w.BodyList.Add(b);
            }

            w.ProcessChanges();

            foreach (Joint j in jointList)
            {
                w.AddJoint(j);
            }

            w.ProcessChanges();

        }
开发者ID:guozanhua,项目名称:KinectRagdoll,代码行数:32,代码来源:Serializer.cs

示例2: Body

        public Body(World world, object userData)
        {
            FixtureList = new List<Fixture>(32);
            BodyId = _bodyIdCounter++;

            World = world;
            UserData = userData;

            FixedRotation = false;
            IsBullet = false;
            SleepingAllowed = true;
            Awake = true;
            BodyType = BodyType.Static;
            Enabled = true;

            Xf.R.Set(0);

            world.AddBody(this);
        }
开发者ID:BraveSirAndrew,项目名称:farseerduality,代码行数:19,代码来源:Body.cs

示例3: Body

        public Body(World world, Vector2? position = null, float rotation = 0, object userdata = null)
        {
            FixtureList = new List<Fixture>();
            _world = world;

            UserData = userdata;
            GravityScale = 1.0f;
            BodyType = BodyType.Static;
            Enabled = true; //FPE note: Also creates proxies in the broadphase

            _xf.q.Set(rotation);

            if (position.HasValue)
            {
                _xf.p = position.Value;
                _sweep.C0 = _xf.p;
                _sweep.C = _xf.p;
                _sweep.A0 = rotation;
                _sweep.A = rotation;
            }

            world.AddBody(this); //FPE note: bodies can't live without a World
        }
开发者ID:Alexz18z35z,项目名称:Gibbo2D,代码行数:23,代码来源:Body.cs

示例4: Body

        public Body(World world, Vector2? position = null, float rotation = 0, object userdata = null)
        {
            FixtureList = new List<Fixture>();
            BodyId = _bodyIdCounter++;
            World = world;

            UserData = userdata;
            GravityScale = 1.0f;
            AppendFlags(BodyFlags.AutoSleep);

            #if !USE_AWAKE_BODY_SET
            Awake = true;
            #endif
            BodyType = BodyType.Static;
            Enabled = true;

            Xf.q.Set(rotation);

            if (position.HasValue)
            {
                Xf.p = position.Value;
                Sweep.C0 = Xf.p;
                Sweep.C = Xf.p;
                Sweep.A0 = rotation;
                Sweep.A = rotation;
            }

            world.AddBody(this);
        }
开发者ID:boris2,项目名称:mmogameproject2,代码行数:29,代码来源:Body.cs

示例5: Body

        public Body(World world, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userdata = null)
        {
            FixtureList = new List<Fixture>();
            BodyId = _bodyIdCounter++;

            _world = world;
            _enabled = true;
            _awake = true;
            _sleepingAllowed = true;

            UserData = userdata;
            GravityScale = 1.0f;
            BodyType = bodyType;

            _xf.q.Set(rotation);

            //FPE: optimization
            if (position != Vector2.Zero)
            {
                _xf.p = position;
                _sweep.C0 = _xf.p;
                _sweep.C = _xf.p;
            }

            //FPE: optimization
            if (rotation != 0)
            {
                _sweep.A0 = rotation;
                _sweep.A = rotation;
            }

            world.AddBody(this); //FPE note: bodies can't live without a World
        }
开发者ID:Daramkun,项目名称:Misty,代码行数:33,代码来源:Body.cs

示例6: Body

        public Body(World world, object userData)
        {
            FixtureList = new List<Fixture>(32);
            BodyId = _bodyIdCounter++;

            World = world;
            UserData = userData;

            GravityScale = 1.0f;
            FixedRotation = false;
            IsBullet = false;
            SleepingAllowed = true;
#if !USE_AWAKE_BODY_SET
            Awake = true;
#endif
            BodyType = BodyType.Static;
            Enabled = true;

            Xf.q.Set(0);

            world.AddBody(this);
        }
开发者ID:frotein,项目名称:TinyUniverse,代码行数:22,代码来源:Body.cs


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