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


C# Body.GetLocalPoint方法代码示例

本文整理汇总了C#中Body.GetLocalPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Body.GetLocalPoint方法的具体用法?C# Body.GetLocalPoint怎么用?C# Body.GetLocalPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Body的用法示例。


在下文中一共展示了Body.GetLocalPoint方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FixedLineJoint

        public FixedLineJoint(Body body, Vector2 bodyAnchor, Vector2 worldAnchor, Vector2 axis)
            : base(body)
        {
            JointType = JointType.FixedLine;

            //David: Start here
            LocalAnchorA = body.GetLocalPoint(bodyAnchor);
            LocalAnchorB = body.GetLocalPoint(bodyAnchor);
            LocalXAxis = body.GetLocalVector(axis);
        }
开发者ID:HaKDMoDz,项目名称:Zazumo,代码行数:10,代码来源:FixedLineJoint.cs

示例2: LineJoint

        public LineJoint(Body bA, Body bB, Vector2 anchor, Vector2 axis)
            : base(bA, bB)
        {
            JointType = JointType.Line;

            LocalAnchorA = bA.GetLocalPoint(anchor);
            LocalAnchorB = bB.GetLocalPoint(anchor);
            LocalXAxis = bA.GetLocalVector(axis);
        }
开发者ID:Nailz,项目名称:MonoGame-Samples,代码行数:9,代码来源:LineJoint.cs

示例3: WheelJoint

 public WheelJoint(Body bA, Body bB, FVector2 anchor, FVector2 axis)
     : base(bA, bB)
 {
     JointType = JointType.Wheel;
     LocalAnchorA = bA.GetLocalPoint(anchor);
     LocalAnchorB = bB.GetLocalPoint(anchor);
     m_localXAxisA = bA.GetLocalVector(axis);
     m_localYAxisA = MathUtils.Cross(1.0f, m_localXAxisA);
 }
开发者ID:pracalic,项目名称:Farseer-Unity3D,代码行数:9,代码来源:WheelJoint.cs

示例4: FixedLineJoint

        /// <summary>
        /// Initialize the bodies, anchors, axis, and reference angle using the local
        /// anchor and world axis.
        /// This requires defining a line of
        /// motion using an axis and an anchor point. Uses local
        /// anchor points and a local axis so that the initial configuration
        /// can violate the constraint slightly. The joint translation is zero
        /// when the local anchor points coincide in world space. Using local
        /// anchors and a local axis helps when saving and loading a game.
        /// </summary>
        /// <param name="bodyA">The first body.</param>
        /// <param name="worldAnchor">The anchor.</param>
        /// <param name="axis">The axis.</param>
        public FixedLineJoint(Body bodyA, Vector2 worldAnchor, Vector2 axis)
            : base(bodyA)
        {
            JointType = JointType.FixedLine;

            BodyB = bodyA;

            LocalAnchorA = worldAnchor;
            LocalAnchorB = BodyB.GetLocalPoint(worldAnchor);

            _localXAxis1 = bodyA.GetLocalVector(axis);
            _localYAxis1 = MathUtils.Cross(1.0f, _localXAxis1);
            _localYAxis1 = MathUtils.Cross(1.0f, _localXAxis1);

            _limitState = LimitState.Inactive;
        }
开发者ID:dvgamer,项目名称:GhostLegend-XNA,代码行数:29,代码来源:FixedLineJoint.cs

示例5: RopeJoint

        /// <summary>
        /// Constructor for RopeJoint.
        /// </summary>
        /// <param name="bodyA">The first body</param>
        /// <param name="bodyB">The second body</param>
        /// <param name="anchorA">The anchor on the first body</param>
        /// <param name="anchorB">The anchor on the second body</param>
        /// <param name="useWorldCoordinates">Set to true if you are using world coordinates as anchors.</param>
        public RopeJoint(Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false)
            : base(bodyA, bodyB)
        {
            JointType = JointType.Rope;

            if (useWorldCoordinates)
            {
                LocalAnchorA = bodyA.GetLocalPoint(anchorA);
                LocalAnchorB = bodyB.GetLocalPoint(anchorB);
            }
            else
            {
                LocalAnchorA = anchorA;
                LocalAnchorB = anchorB;
            }

            //FPE feature: Setting default MaxLength
            Vector2 d = WorldAnchorB - WorldAnchorA;
            MaxLength = d.Length();
        }
开发者ID:Woktopus,项目名称:Gamejam_lib,代码行数:28,代码来源:RopeJoint.cs

示例6: WeldJoint

        /// <summary>
        /// You need to specify an anchor point where they are attached.
        /// The position of the anchor point is important for computing the reaction torque.
        /// </summary>
        /// <param name="bodyA">The first body</param>
        /// <param name="bodyB">The second body</param>
        /// <param name="anchorA">The first body anchor.</param>
        /// <param name="anchorB">The second body anchor.</param>
        /// <param name="useWorldCoordinates">Set to true if you are using world coordinates as anchors.</param>
        public WeldJoint(Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false)
            : base(bodyA, bodyB)
        {
            JointType = JointType.Weld;

            if (useWorldCoordinates)
            {
                LocalAnchorA = bodyA.GetLocalPoint(anchorA);
                LocalAnchorB = bodyB.GetLocalPoint(anchorB);
            }
            else
            {
                LocalAnchorA = anchorA;
                LocalAnchorB = anchorB;
            }

            ReferenceAngle = BodyB.Rotation - BodyA.Rotation;
        }
开发者ID:nagyist,项目名称:Farseer-Physics-Engine-For-MonoMac,代码行数:27,代码来源:WeldJoint.cs

示例7: WheelJoint

        /// <summary>
        /// Constructor for WheelJoint
        /// </summary>
        /// <param name="bodyA">The first body</param>
        /// <param name="bodyB">The second body</param>
        /// <param name="anchor">The anchor point</param>
        /// <param name="axis">The axis</param>
        /// <param name="useWorldCoordinates">Set to true if you are using world coordinates as anchors.</param>
        public WheelJoint(Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis, bool useWorldCoordinates = false)
            : base(bodyA, bodyB)
        {
            JointType = JointType.Wheel;

            if (useWorldCoordinates)
            {
                LocalAnchorA = bodyA.GetLocalPoint(anchor);
                LocalAnchorB = bodyB.GetLocalPoint(anchor);
            }
            else
            {
                LocalAnchorA = bodyA.GetLocalPoint(bodyB.GetWorldPoint(anchor));
                LocalAnchorB = anchor;
            }

            Axis = axis; //FPE only: We maintain the original value as it is supposed to.
        }
开发者ID:Woktopus,项目名称:Gamejam_lib,代码行数:26,代码来源:WheelJoint.cs

示例8: DistanceJoint

        /// <summary>
        /// This requires defining an
        /// anchor point on both bodies and the non-zero length of the
        /// distance joint. If you don't supply a length, the local anchor points
        /// is used so that the initial configuration can violate the constraint
        /// slightly. This helps when saving and loading a game.
        /// @warning Do not use a zero or short length.
        /// </summary>
        /// <param name="bodyA">The first body</param>
        /// <param name="bodyB">The second body</param>
        /// <param name="localAnchorA">The first body anchor</param>
        /// <param name="localAnchorB">The second body anchor</param>
        public DistanceJoint(Body bodyA, Body bodyB, Vector2 localAnchorA, Vector2 localAnchorB, bool useWorldCoordinates = true)
            : base(bodyA, bodyB)
        {
            JointType = JointType.Distance;

            if (useWorldCoordinates)
            {
                LocalAnchorA = bodyA.GetLocalPoint(localAnchorA);
                LocalAnchorB = bodyB.GetLocalPoint(localAnchorB);

                Vector2 d = localAnchorB - localAnchorA;
                Length = d.Length();

            }
            else
            {
                LocalAnchorA = localAnchorA;
                LocalAnchorB = localAnchorB;
                Length = (BodyB.GetWorldPoint(ref LocalAnchorB) - BodyA.GetWorldPoint(ref LocalAnchorA)).Length();
            }
        }
开发者ID:netonjm,项目名称:Rube.Net,代码行数:33,代码来源:DistanceJoint.cs

示例9: WeldJoint

        /// <summary>
        /// You need to specify a local anchor point
        /// where they are attached and the relative body angle. The position
        /// of the anchor point is important for computing the reaction torque.
        /// You can change the anchor points relative to bodyA or bodyB by changing LocalAnchorA
        /// and/or LocalAnchorB.
        /// </summary>
        /// <param name="bodyA">The first body</param>
        /// <param name="bodyB">The second body</param>
        /// <param name="localAnchorA">The first body anchor.</param>
        /// <param name="localAnchorB">The second body anchor.</param>
        public WeldJoint(Body bodyA, Body bodyB, Vector2 localAnchorA, Vector2 localAnchorB)
            : base(bodyA, bodyB)
        {
            JointType = JointType.Weld;

            LocalAnchorA = bodyA.GetLocalPoint(localAnchorA);
            LocalAnchorB = bodyB.GetLocalPoint(localAnchorB);
            ReferenceAngle = BodyB.Rotation - BodyA.Rotation;
        }
开发者ID:netonjm,项目名称:Rube.Net,代码行数:20,代码来源:WeldJoint.cs

示例10: RevoluteJoint

        /// <summary>
        /// Initialize the bodies and world anchor.
        /// </summary>
        /// <param name="bodyA">The first body.</param>
        /// <param name="bodyB">The second body.</param>
        /// <param name="worldAnchor">The world coordinate anchor.</param>
        public RevoluteJoint(Body bodyA, Body bodyB, FVector2 worldAnchor)
            : base(bodyA, bodyB)
        {
            JointType = JointType.Revolute;

            // Changed to local coordinates.
            LocalAnchorA = bodyA.GetLocalPoint(worldAnchor);
            LocalAnchorB = bodyB.GetLocalPoint(worldAnchor);

            ReferenceAngle = BodyB.Rotation - BodyA.Rotation;

            _impulse = FVector3.Zero;

            _limitState = LimitState.Inactive;
        }
开发者ID:frotein,项目名称:TinyUniverse,代码行数:21,代码来源:RevoluteJoint.cs

示例11: DistanceJoint

        /// <summary>
        /// This requires defining an
        /// anchor point on both bodies and the non-zero length of the
        /// distance joint. If you don't supply a length, the local anchor points
        /// is used so that the initial configuration can violate the constraint
        /// slightly. This helps when saving and loading a game.
        /// Warning Do not use a zero or short length.
        /// </summary>
        /// <param name="bodyA">The first body</param>
        /// <param name="bodyB">The second body</param>
        /// <param name="anchorA">The first body anchor</param>
        /// <param name="anchorB">The second body anchor</param>
        /// <param name="useWorldCoordinates">Set to true if you are using world coordinates as anchors.</param>
        public DistanceJoint(Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false)
            : base(bodyA, bodyB)
        {
            JointType = JointType.Distance;

            if (useWorldCoordinates)
            {
                LocalAnchorA = bodyA.GetLocalPoint(ref anchorA);
                LocalAnchorB = bodyB.GetLocalPoint(ref anchorB);
                Length = (anchorB - anchorA).Length;
            }
            else
            {
                LocalAnchorA = anchorA;
                LocalAnchorB = anchorB;
                Length = (BodyB.GetWorldPoint(ref anchorB) - BodyA.GetWorldPoint(ref anchorA)).Length;
            }
        }
开发者ID:Daramkun,项目名称:Misty,代码行数:31,代码来源:DistanceJoint.cs

示例12: PrismaticJoint

        public PrismaticJoint(Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis)
            : base(bodyA, bodyB)
        {
            JointType = JointType.Prismatic;

            LocalAnchorA = bodyA.GetLocalPoint(anchor);
            LocalAnchorB = bodyB.GetLocalPoint(anchor);

            _localXAxisA = BodyA.GetLocalVector(axis);
            _localXAxisA.Normalize();
            _localYAxisA = MathUtils.Cross(1.0f, _localXAxisA);
            _referenceAngle = BodyB.Rotation - BodyA.Rotation;

            _limitState = LimitState.Inactive;
        }
开发者ID:boris2,项目名称:mmogameproject2,代码行数:15,代码来源:PrismaticJoint.cs

示例13: Initialize

 /// <summary>
 /// Initialize the bodies, anchors, and length using the world anchors.
 /// </summary>
 /// <param name="b1">First body</param>
 /// <param name="b2">Second body</param>
 /// <param name="anchor1">World anchor on first body</param>
 /// <param name="anchor2">World anchor on second body</param>
 public void Initialize(Body b1, Body b2, Vec2 anchor1, Vec2 anchor2)
 {
     BodyA = b1;
     BodyB = b2;
     LocalAnchorA.Set(BodyA.GetLocalPoint(anchor1));
     LocalAnchorB.Set(BodyB.GetLocalPoint(anchor2));
     Vec2 d = anchor2.Sub(anchor1);
     Length = d.Length();
 }
开发者ID:gerich-home,项目名称:box2dnet,代码行数:16,代码来源:DistanceJointDef.cs

示例14: Initialize

 /// <summary>
 /// Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
 /// </summary>
 public void Initialize(Body b1, Body b2, Vec2 ga1, Vec2 ga2, Vec2 anchor1, Vec2 anchor2, float r)
 {
     BodyA = b1;
     BodyB = b2;
     GroundAnchorA = ga1;
     GroundAnchorB = ga2;
     LocalAnchorA = BodyA.GetLocalPoint(anchor1);
     LocalAnchorB = BodyB.GetLocalPoint(anchor2);
     Vec2 d1 = anchor1.Sub(ga1);
     LengthA = d1.Length();
     Vec2 d2 = anchor2.Sub(ga2);
     LengthB = d2.Length();
     Ratio = r;
     Debug.Assert(Ratio > Settings.EPSILON);
 }
开发者ID:gerich-home,项目名称:box2dnet,代码行数:18,代码来源:PulleyJointDef.cs


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