本文整理汇总了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);
}
示例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.
}
示例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();
}
示例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();
}
示例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();
}
}
示例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;
}