本文整理汇总了C#中Transform.Set方法的典型用法代码示例。如果您正苦于以下问题:C# Transform.Set方法的具体用法?C# Transform.Set怎么用?C# Transform.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform.Set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Intersect
public bool Intersect(Fixture fixture, ref Vector2 point, out Feature result)
{
result = new Feature();
Manifold manifold = new Manifold();
Vector2 normal;
FixedArray2<Vector2> points;
Transform transformB = new Transform();
transformB.Set(Vector2.Zero, 0);
circle.Position = point;
PolygonShape polygonShape = fixture.Shape as PolygonShape;
switch (fixture.ShapeType)
{
case ShapeType.Polygon:
Collision.Collision.CollidePolygonAndCircle(ref manifold, polygonShape, ref fixture.Body.Xf, circle, ref transformB);
ContactSolver.WorldManifold.Initialize(ref manifold, ref fixture.Body.Xf, polygonShape.Radius, ref transformB, circle.Radius, out normal, out points);
result.Distance = (point-(fixture.Body.Position + new Vector2(1.5f, 1.5f))).Length();
break;
default:
throw new ArgumentOutOfRangeException();
}
//result.Position = points[0];
//result.Normal = normal;
//result.Distance = 1f;
bool intersects = manifold.PointCount >= 1;//collision.Intersect(ref localPoint, out result);
if (intersects)
{
result.Position = points[0];
result.Normal = normal;
result.Distance *= -1;
//Vector2 collisionPoint = points[0];
//result.Position = Body.GetWorldPoint(ref collisionPoint);
//result.Normal = Body.GetWorldVector(ref normal);
}
return intersects;
}
示例2: checkObstacle
private bool checkObstacle(float size, Vector2 pos, float orientation)
{
PolygonShape shape = new PolygonShape(1f);
shape.SetAsBox(size, size);
Transform xform = new Transform();
xform.Set(pos, orientation);
foreach (Obstacle obs in Obstacles)
{
Body obsBody = obs.Body;
Transform obstXform;
obsBody.GetTransform(out obstXform);
if (obsBody.FixtureList != null && AABB.TestOverlap(shape, 0, obsBody.FixtureList[0].Shape, 0, ref xform, ref obstXform))
return false;
}
return true;
}