本文整理汇总了C#中Vertices.Rotate方法的典型用法代码示例。如果您正苦于以下问题:C# Vertices.Rotate方法的具体用法?C# Vertices.Rotate怎么用?C# Vertices.Rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vertices
的用法示例。
在下文中一共展示了Vertices.Rotate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFanPiece
public static PolygonShape CreateFanPiece(float sideLength, float interiorAngle, float rotationAngle)
{
FVector2[] pointList = new FVector2[3];
interiorAngle = Mathf.PI/180.0f*interiorAngle;
rotationAngle = Mathf.PI/180.0f*rotationAngle;
pointList[0] = new FVector2(0.0f, 0.0f);
pointList[1] = new FVector2(sideLength, 0.0f);
pointList[2] = new FVector2(sideLength*Mathf.Cos(interiorAngle), sideLength*Mathf.Sin(interiorAngle));
Vertices vertices = new Vertices(pointList);
vertices.Rotate(rotationAngle);
return new PolygonShape(vertices, 1.0f);
}
示例2: CreateFanSet
//More efficient b/c uses Sin/Cos only once
public static PolygonShape[] CreateFanSet(float radius, float fanAngle, int shardCount, int density)
{
PolygonShape[] shapeList = new PolygonShape[shardCount];
float interiorAngle = fanAngle / ((float) shardCount) * Mathf.PI/180.0f;
FVector2[] pointList = new FVector2[3];
pointList[0] = new FVector2(0.0f, 0.0f);
pointList[1] = new FVector2(radius, 0.0f);
pointList[2] = new FVector2(radius*Mathf.Cos(interiorAngle), radius*Mathf.Sin(interiorAngle));
Vertices vertices = new Vertices(pointList);
for(int index = 0; index < shardCount; index++) {
shapeList[index] = new PolygonShape(vertices, density); //PolygonShape makes a deep copy of vertices so I can reuse this sucker
vertices.Rotate(interiorAngle);
}
return shapeList;
}
示例3: ObstacleVertices
private static Vertices ObstacleVertices(int width, float rotate, bool flip)
{
var corners = flip ? new Vector2[] {
new Vector2(0f,0f),
new Vector2(width*60f, -60f),
new Vector2(width*60f, 0f),
} : new Vector2[] {
new Vector2(0f,0f),
new Vector2(width*60f, 0f),
new Vector2(width*60f, 60f),
};
var vert = new Vertices(corners);
vert.Rotate(rotate.ToRadians());
var flipVect = new Vector2(1f, -1f);
return vert;
}