本文整理汇总了C#中FarseerPhysics.Collision.Shapes.Shape.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Shape.Clone方法的具体用法?C# Shape.Clone怎么用?C# Shape.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FarseerPhysics.Collision.Shapes.Shape
的用法示例。
在下文中一共展示了Shape.Clone方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Fixture
public Fixture(Body body, Shape shape, object userData)
{
if (Settings.UseFPECollisionCategories)
_collisionCategories = Category.All;
else
_collisionCategories = Category.Cat1;
_collidesWith = Category.All;
_collisionGroup = 0;
//Fixture defaults
Friction = 0.2f;
Restitution = 0;
IsSensor = false;
Body = body;
UserData = userData;
if (Settings.ConserveMemory)
Shape = shape;
else
Shape = shape.Clone();
RegisterFixture();
}
示例2: Fixture
internal Fixture(Body body, Shape shape, object userData = null)
{
#if DEBUG
if (shape.ShapeType == ShapeType.Polygon)
((PolygonShape)shape).Vertices.AttachedToBody = true;
#endif
_collisionCategories = Settings.DefaultFixtureCollisionCategories;
_collidesWith = Settings.DefaultFixtureCollidesWith;
_collisionGroup = 0;
IgnoreCCDWith = Settings.DefaultFixtureIgnoreCCDWith;
//Fixture defaults
Friction = 0.2f;
Restitution = 0;
Body = body;
IsSensor = false;
UserData = userData;
Shape = Settings.ConserveMemory ? shape : shape.Clone();
RegisterFixture();
}
示例3: FSFixture
public FSFixture(FSBody body, Shape shape, object userData) {
_collisionCategories = FSSettings.DefaultFixtureCollisionCategories;
_collidesWith = FSSettings.DefaultFixtureCollidesWith;
_collisionGroup = 0;
#if USE_IGNORE_CCD_CATEGORIES
IgnoreCCDWith = FSSettings.DefaultFixtureIgnoreCCDWith;
#endif
//Fixture defaults
Friction = 0.2f;
Restitution = 0;
Body = body;
IsSensor = false;
UserData = userData;
if (FSSettings.ConserveMemory)
Shape = shape;
else
if (shape != null) Shape = shape.Clone();
RegisterFixture();
}
示例4: Fixture
internal Fixture(Body body, Shape shape, float density)
{
//Fixture defaults
Friction = 0.2f;
_collisionCategories = CollisionCategory.All;
_collidesWith = CollisionCategory.All;
IsSensor = false;
Body = body;
#if ConserveMemory
Shape = shape;
#else
Shape = shape.Clone();
#endif
// 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;
Density = density;
FixtureId = _fixtureIdCounter++;
}
示例5: 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);
}
}
示例6: GlomFixture
private static Fixture GlomFixture(World world, Body oldBody, List<Body> thisSideBodies, Shape shape, DebugMaterial mat, List<Joint> joints)
{
foreach (Body lb in thisSideBodies)
{
foreach (Fixture lf in lb.FixtureList)
{
Manifold m = new Manifold();
PolygonShape newShape = shape.Clone() as PolygonShape;
PolygonShape existingShape = lf.Shape as PolygonShape;
if (newShape != null && existingShape != null)
{
Collision.Collision.CollidePolygons(ref m, newShape, ref oldBody.Xf, existingShape, ref oldBody.Xf);
if (m.PointCount > 0)
{
Fixture glommed = lb.CreateFixture(newShape, mat);
transferJoints(oldBody, joints, lb, glommed);
return glommed;
}
}
}
}
Body lb2 = new Body(world);
if (!thisSideBodies.Any())
{
transferJoints(oldBody, joints, lb2, null);
}
lb2.Position = oldBody.Position;
lb2.Rotation = oldBody.Rotation;
thisSideBodies.Add(lb2);
Fixture separate = lb2.CreateFixture(shape.Clone(), mat);
transferJoints(oldBody, joints, lb2, separate);
return separate;
}