本文整理汇总了C#中FarseerPhysics.Dynamics.Body.ResetMassData方法的典型用法代码示例。如果您正苦于以下问题:C# Body.ResetMassData方法的具体用法?C# Body.ResetMassData怎么用?C# Body.ResetMassData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FarseerPhysics.Dynamics.Body
的用法示例。
在下文中一共展示了Body.ResetMassData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Fixture
public Fixture(Body body, Shape shape, Object userData)
{
CollisionFilter = new CollisionFilter(this);
//Fixture defaults
Friction = 0.2f;
Restitution = 0;
IsSensor = false;
Body = body;
UserData = userData;
if (Settings.ConserveMemory)
Shape = shape;
else
Shape = shape.Clone();
// Reserve proxy space
int childCount = Shape.ChildCount;
Proxies = new FixtureProxy[childCount];
for (int i = 0; i < childCount; ++i)
{
Proxies[i] = new FixtureProxy();
Proxies[i].Fixture = null;
Proxies[i].ProxyId = BroadPhase.NullProxy;
}
ProxyCount = 0;
FixtureId = _fixtureIdCounter++;
if ((Body.Flags & BodyFlags.Enabled) == BodyFlags.Enabled)
{
BroadPhase broadPhase = Body.World.ContactManager.BroadPhase;
CreateProxies(broadPhase, ref Body.Xf);
}
Body.FixtureList.Add(this);
// Adjust mass properties if needed.
if (Shape._density > 0.0f)
{
Body.ResetMassData();
}
// Let the world know we have a new fixture. This will cause new contacts
// to be created at the beginning of the next time step.
Body.World.Flags |= WorldFlags.NewFixture;
if (Body.World.FixtureAdded != null)
{
Body.World.FixtureAdded(this);
}
}