com.badlogic.gdx.physics.box2d.Body.getLocalPoint()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中com.badlogic.gdx.physics.box2d.Body.getLocalPoint()方法的一些代码示例,展示了Body.getLocalPoint()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.getLocalPoint()方法的具体详情如下:
包路径:com.badlogic.gdx.physics.box2d.Body
类名称:Body
方法名:getLocalPoint

Body.getLocalPoint介绍

[英]Gets a local point relative to the body's origin given a world point.
[中]获取相对于给定世界点的实体原点的局部点。

代码示例

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchor) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  localAnchorA.set(bodyA.getLocalPoint(anchor));
  localAnchorB.set(bodyB.getLocalPoint(anchor));
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchor) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  localAnchorA.set(bodyA.getLocalPoint(anchor));
  localAnchorB.set(bodyB.getLocalPoint(anchor));
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, and length using the world anchors. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  this.localAnchorA.set(bodyA.getLocalPoint(anchorA));
  this.localAnchorB.set(bodyB.getLocalPoint(anchorB));
  this.length = anchorA.dst(anchorB);
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, and length using the world anchors. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  this.localAnchorA.set(bodyA.getLocalPoint(anchorA));
  this.localAnchorB.set(bodyB.getLocalPoint(anchorB));
  this.length = anchorA.dst(anchorB);
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, and reference angle using a world anchor point. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchor) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  localAnchorA.set(bodyA.getLocalPoint(anchor));
  localAnchorB.set(bodyB.getLocalPoint(anchor));
  referenceAngle = bodyB.getAngle() - bodyA.getAngle();
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, and reference angle using a world anchor point. */
public void initialize (Body body1, Body body2, Vector2 anchor) {
  this.bodyA = body1;
  this.bodyB = body2;
  this.localAnchorA.set(body1.getLocalPoint(anchor));
  this.localAnchorB.set(body2.getLocalPoint(anchor));
  referenceAngle = body2.getAngle() - body1.getAngle();
}

代码示例来源:origin: libgdx/libgdx

public void initialize (Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  localAnchorA.set(bodyA.getLocalPoint(anchor));
  localAnchorB.set(bodyB.getLocalPoint(anchor));
  localAxisA.set(bodyA.getLocalVector(axis));
}

代码示例来源:origin: libgdx/libgdx

public void initialize (Body body1, Body body2, Vector2 anchor) {
  this.bodyA = body1;
  this.bodyB = body2;
  this.localAnchorA.set(body1.getLocalPoint(anchor));
  this.localAnchorB.set(body2.getLocalPoint(anchor));
  referenceAngle = body2.getAngle() - body1.getAngle();
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, and reference angle using a world anchor point. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchor) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  localAnchorA.set(bodyA.getLocalPoint(anchor));
  localAnchorB.set(bodyB.getLocalPoint(anchor));
  referenceAngle = bodyB.getAngle() - bodyA.getAngle();
}

代码示例来源:origin: libgdx/libgdx

public void initialize (Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  localAnchorA.set(bodyA.getLocalPoint(anchor));
  localAnchorB.set(bodyB.getLocalPoint(anchor));
  localAxisA.set(bodyA.getLocalVector(axis));
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  localAnchorA.set(bodyA.getLocalPoint(anchor));
  localAnchorB.set(bodyB.getLocalPoint(anchor));
  localAxisA.set(bodyA.getLocalVector(axis));
  referenceAngle = bodyB.getAngle() - bodyA.getAngle();
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchor, Vector2 axis) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  localAnchorA.set(bodyA.getLocalPoint(anchor));
  localAnchorB.set(bodyB.getLocalPoint(anchor));
  localAxisA.set(bodyA.getLocalVector(axis));
  referenceAngle = bodyB.getAngle() - bodyA.getAngle();
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors. */
public void initialize (Body bodyA, Body bodyB, Vector2 groundAnchorA, Vector2 groundAnchorB, Vector2 anchorA,
  Vector2 anchorB, float ratio) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  this.groundAnchorA.set(groundAnchorA);
  this.groundAnchorB.set(groundAnchorB);
  this.localAnchorA.set(bodyA.getLocalPoint(anchorA));
  this.localAnchorB.set(bodyB.getLocalPoint(anchorB));
  lengthA = anchorA.dst(groundAnchorA);
  lengthB = anchorB.dst(groundAnchorB);
  this.ratio = ratio;
  float C = lengthA + ratio * lengthB;
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors. */
public void initialize (Body bodyA, Body bodyB, Vector2 groundAnchorA, Vector2 groundAnchorB, Vector2 anchorA,
  Vector2 anchorB, float ratio) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  this.groundAnchorA.set(groundAnchorA);
  this.groundAnchorB.set(groundAnchorB);
  this.localAnchorA.set(bodyA.getLocalPoint(anchorA));
  this.localAnchorB.set(bodyB.getLocalPoint(anchorB));
  lengthA = anchorA.dst(groundAnchorA);
  lengthB = anchorB.dst(groundAnchorB);
  this.ratio = ratio;
  float C = lengthA + ratio * lengthB;
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies and offsets using the current transforms. */
public void initialize (Body body1, Body body2) {
  this.bodyA = body1;
  this.bodyB = body2;
  this.linearOffset.set(bodyA.getLocalPoint(bodyB.getPosition()));
  this.angularOffset = bodyB.getAngle() - bodyA.getAngle();
}

代码示例来源:origin: libgdx/libgdx

/** Initialize the bodies and offsets using the current transforms. */
public void initialize (Body body1, Body body2) {
  this.bodyA = body1;
  this.bodyB = body2;
  this.linearOffset.set(bodyA.getLocalPoint(bodyB.getPosition()));
  this.angularOffset = bodyB.getAngle() - bodyA.getAngle();
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-box2d

/** Initialize the bodies, anchors, axis, and reference angle using the world anchor and world axis. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchor) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  localAnchorA.set(bodyA.getLocalPoint(anchor));
  localAnchorB.set(bodyB.getLocalPoint(anchor));
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-box2d

/** Initialize the bodies, anchors, and length using the world anchors. */
public void initialize (Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB) {
  this.bodyA = bodyA;
  this.bodyB = bodyB;
  this.localAnchorA.set(bodyA.getLocalPoint(anchorA));
  this.localAnchorB.set(bodyB.getLocalPoint(anchorB));
  this.length = anchorA.dst(anchorB);
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-box2d

/** Initialize the bodies, anchors, and reference angle using a world anchor point. */
public void initialize (Body body1, Body body2, Vector2 anchor) {
  this.bodyA = body1;
  this.bodyB = body2;
  this.localAnchorA.set(body1.getLocalPoint(anchor));
  this.localAnchorB.set(body2.getLocalPoint(anchor));
  referenceAngle = body2.getAngle() - body1.getAngle();
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-box2d

/** Initialize the bodies and offsets using the current transforms. */
public void initialize (Body body1, Body body2) {
  this.bodyA = body1;
  this.bodyB = body2;
  this.linearOffset.set(bodyA.getLocalPoint(bodyB.getPosition()));
  this.angularOffset = bodyB.getAngle() - bodyA.getAngle();
}

相关文章