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


C# Body.getLocalPoint方法代码示例

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


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

示例1: initialize

 /**
    * Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
    */
 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:Nomad1,项目名称:sharpbox2d,代码行数:18,代码来源:PulleyJointDef.cs

示例2: 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;
			}

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

示例3: 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:prime31,项目名称:Nez,代码行数:28,代码来源:RopeJoint.cs

示例4: 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 virtual void initialize(Body b1, Body b2, Vec2 anchor1, Vec2 anchor2)
 {
     bodyA = b1;
     bodyB = b2;
     localAnchorA.set_Renamed(bodyA.getLocalPoint(anchor1));
     localAnchorB.set_Renamed(bodyB.getLocalPoint(anchor2));
     Vec2 d = anchor2.sub(anchor1);
     length = d.length();
 }
开发者ID:thdtjsdn,项目名称:box2dnet,代码行数:16,代码来源:DistanceJointDef.cs

示例5: 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 = ( base.bodyB.getWorldPoint( ref anchorB ) - base.bodyA.getWorldPoint( ref anchorA ) ).Length();
			}
		}
开发者ID:prime31,项目名称:Nez,代码行数:30,代码来源:DistanceJoint.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 = base.bodyB.rotation - base.bodyA.rotation;
		}
开发者ID:prime31,项目名称:Nez,代码行数:27,代码来源:WeldJoint.cs


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