本文整理汇总了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;
}
示例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();
}
示例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();
}
示例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);
}
示例5: CreateBody
public static Body CreateBody(World world)
{
Body body = new Body(world);
world.ProcessChanges();
return body;
}
示例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;
}