本文整理汇总了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();
}
示例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);
}
示例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
}
示例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);
}
示例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
}
示例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);
}