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


C# World.ProcessChanges方法代码示例

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


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

示例1: Init

        public override void Init(FarseerPhysics.Dynamics.World w, Kinect.RagdollManager r)
        {
            world = w;
            target = r.ragdoll;
            body.setWorld(w);

            body.OnCollision += new OnCollisionEventHandler(body_OnCollision);

            world.ProcessChanges();
            IsOperational = true;
        }
开发者ID:guozanhua,项目名称:KinectRagdoll,代码行数:11,代码来源:WallPopper.cs

示例2: KillMouseJoints

        private static void KillMouseJoints(World w, KinectRagdollGame g)
        {
            List<FixedMouseJoint> mjs = new List<FixedMouseJoint>();

            foreach (Joint j in w.JointList)
            {
                if (j is FixedMouseJoint) w.RemoveJoint(j);
            }

            w.ProcessChanges();
        }
开发者ID:guozanhua,项目名称:KinectRagdoll,代码行数:11,代码来源:Serializer.cs

示例3: 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

示例4: SetWorld

 /// <summary>
 /// Assigns a physics world to this scene. Can only be done if there isn't already a physics world assigned.
 /// </summary>
 public void SetWorld(World world)
 {
     //Debug.Assert(World == null, "A physics world has already been assigned to this scene.");
     World = world;
     World.ProcessChanges();
     _contactListener = new PhyicsListener(this);
 }
开发者ID:AyyTee,项目名称:Aventyr,代码行数:10,代码来源:Scene.cs

示例5: CreateBody

 public static Body CreateBody(World world)
 {
     Body body = new Body(world);
     world.ProcessChanges();
     return body;
 }
开发者ID:AyyTee,项目名称:Aventyr,代码行数:6,代码来源:BodyExt.cs

示例6: Cut


//.........这里部分代码省略.........

                List<Joint> leftJoints = new List<Joint>();
                List<Joint> rightJoints = new List<Joint>();

                foreach (Joint j in b.JointList)
                {
                    if (isLeft(start, end, j.WorldAnchorA))
                        leftJoints.Add(j);
                    else
                        rightJoints.Add(j);
                }

                //List<Fixture> leftList = new List<Fixture>();
                //List<Fixture> rightList = new List<Fixture>();
                Fixture[] bodyFixtures = new Fixture[b.FixtureList.Count];
                b.FixtureList.CopyTo(bodyFixtures);
                b.FixtureList.Clear();
                //leftBodies.Add(b);

                // For each fixture that was sliced through...
                foreach (Fixture fix in (from f in bodyFixtures where fixtures.Contains(f) select f))
                {
                    
                    
                    int i = fixtures.IndexOf(fix);

                    // split this in half and put the halves in the over/under lists
                    Vertices first;
                    Vertices second;
                    SplitShape(fix, entryPoints[i], exitPoints[i], thickness, out first, out second);
                    if (!SanityCheck(first) || !SanityCheck(second))
                    {
                        continue;
                    }
                    PolygonShape leftShape = new PolygonShape(first, fix.Shape.Density);
                    PolygonShape rightShape = new PolygonShape(second, fix.Shape.Density);

                    if (!b.FixtureList.Any())
                    {
                        if (leftShape.MassData.Area > rightShape.MassData.Area)
                        {
                            b.CreateFixture(leftShape, fix.UserData);
                            leftBodies.Add(b);
                            GlomFixture(world, b, rightBodies, rightShape, fix.UserData, rightJoints);
                        }
                        else
                        {
                            b.CreateFixture(rightShape, fix.UserData);
                            rightBodies.Add(b);
                            GlomFixture(world, b, leftBodies, leftShape, fix.UserData, leftJoints);
                        }
                    }
                    else
                    {
                        GlomFixture(world, b, leftBodies, leftShape, fix.UserData, leftJoints);
                        GlomFixture(world, b, rightBodies, rightShape, fix.UserData, rightJoints);
                    }

                                      
                }

                // for each fixture that was NOT sliced through...
                foreach (Fixture fix in (from f in bodyFixtures where !fixtures.Contains(f) select f)) {

                    if (isLeft(start, end, fix))
                    {
                        GlomFixture(world, b, leftBodies, fix.Shape, fix.UserData, leftJoints);
                    }
                    else
                    {
                        GlomFixture(world, b, rightBodies, fix.Shape, fix.UserData, rightJoints);
                        //rightBody.CreateFixture(fix.Shape.Clone(), fix.UserData);
                    }

                    
                }

                foreach (Body bod in leftBodies.Concat(rightBodies))
                {
                    bod.ResetMassData();
                    bod.BodyType = BodyType.Dynamic;
                    bod.Rotation = b.Rotation;
                    bod.LinearVelocity = b.LinearVelocity;
                    bod.AngularVelocity = b.AngularVelocity;
                    bod.Position = b.Position;
                }

                //b.JointList = null;
                //world.RemoveBody(b);

                foreach (Fixture f in bodyFixtures)
                {
                    b.DestroyFixture(f);
                }
                world.ProcessChanges();
            }

            return stoppingPoint;

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


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