本文整理汇总了C#中FarseerPhysics.Dynamics.Fixture.CloneOnto方法的典型用法代码示例。如果您正苦于以下问题:C# Fixture.CloneOnto方法的具体用法?C# Fixture.CloneOnto怎么用?C# Fixture.CloneOnto使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FarseerPhysics.Dynamics.Fixture
的用法示例。
在下文中一共展示了Fixture.CloneOnto方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSensors
// Slight Hack, if both OnSeparation and OnCollision event are subscribed to
// the OnSeparation call is either ignored or lost in the works of the
// Farseer Physics engine. A simple solution is to use 2 fixtures, both sensors, that
// ignore eachother in collision and subscribe to OnSeparation/OnCollision individually
private void CreateSensors(Fixture sensorTemplate)
{
this.collisionFixture = sensorTemplate;
if (!this.sensorBody.FixtureList.Contains(sensorTemplate))
{
this.collisionFixture = sensorTemplate.CloneOnto(this.sensorBody);
}
this.separationFixture = this.collisionFixture.CloneOnto(this.sensorBody);
this.collisionFixture.OnCollision += this.OnCollision;
this.collisionFixture.IsSensor = true;
this.separationFixture.OnSeparation += this.OnSeparation;
this.separationFixture.IsSensor = true;
this.separationFixture.IgnoreCCDWith = Category.All;
foreach (var fixture in this.sensorBody.FixtureList)
{
this.collisionFixture.IgnoreCollisionWith(fixture);
this.separationFixture.IgnoreCollisionWith(fixture);
}
}