当前位置: 首页>>代码示例>>C#>>正文


C# Transform.Set方法代码示例

本文整理汇总了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;
        }
开发者ID:boris2,项目名称:mmogameproject2,代码行数:46,代码来源:RigidBody.cs

示例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;
        }
开发者ID:jgera,项目名称:AutonomousCar,代码行数:18,代码来源:Environment.cs


注:本文中的Transform.Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。