本文整理汇总了C#中FarseerPhysics.Common.Path.subdivideEvenly方法的典型用法代码示例。如果您正苦于以下问题:C# Path.subdivideEvenly方法的具体用法?C# Path.subdivideEvenly怎么用?C# Path.subdivideEvenly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FarseerPhysics.Common.Path
的用法示例。
在下文中一共展示了Path.subdivideEvenly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: evenlyDistributeShapesAlongPath
/// <summary>
/// Duplicates the given Body along the given path for approximatly the given copies.
/// </summary>
/// <param name="world">The world.</param>
/// <param name="path">The path.</param>
/// <param name="shapes">The shapes.</param>
/// <param name="type">The type.</param>
/// <param name="copies">The copies.</param>
/// <param name="userData"></param>
/// <returns></returns>
public static List<Body> evenlyDistributeShapesAlongPath( World world, Path path, IEnumerable<Shape> shapes, BodyType type, int copies, object userData = null )
{
List<Vector3> centers = path.subdivideEvenly( copies );
List<Body> bodyList = new List<Body>();
for( int i = 0; i < centers.Count; i++ )
{
Body b = new Body( world );
// copy the type from original body
b.bodyType = type;
b.position = new Vector2( centers[i].X, centers[i].Y );
b.rotation = centers[i].Z;
b.userData = userData;
foreach( Shape shape in shapes )
{
b.createFixture( shape );
}
bodyList.Add( b );
}
return bodyList;
}