本文整理了Java中org.jbox2d.dynamics.Body.getJointList()
方法的一些代码示例,展示了Body.getJointList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.getJointList()
方法的具体详情如下:
包路径:org.jbox2d.dynamics.Body
类名称:Body
方法名:getJointList
[英]Get the list of all joints attached to this body.
[中]
代码示例来源:origin: libgdx/libgdx
/** Get the list of all joints attached to this body. Do not modify the list! */
public Array<JointEdge> getJointList () {
// FIXME wow this is bad...
org.jbox2d.dynamics.joints.JointEdge jointEdge = body.getJointList();
joints.clear();
while (jointEdge != null) {
JointEdge edge = new JointEdge(world.bodies.get(jointEdge.other), world.joints.get(jointEdge.joint));
joints.add(edge);
jointEdge = jointEdge.next;
}
return joints;
}
代码示例来源:origin: libgdx/libgdx
/** Destroy a rigid body given a definition. No reference to the definition is retained. This function is locked during
* callbacks.
* @warning This automatically deletes all associated shapes and joints.
* @warning This function is locked during callbacks. */
public void destroyBody (Body body) {
JointEdge jointEdge = body.body.getJointList();
while (jointEdge != null) {
JointEdge next = jointEdge.next;
world.destroyJoint(jointEdge.joint);
joints.remove(jointEdge.joint);
jointEdge = next;
}
world.destroyBody(body.body);
bodies.remove(body.body);
for (Fixture fixture : body.fixtures) {
fixtures.remove(fixture.fixture);
}
}
代码示例来源:origin: stackoverflow.com
CopyOnWriteArrayList<Entity> entities = new CopyOnWriteArrayList<Entity>();
public void deleteEntities() {
for(Entity entity: entities){
Body body = entity.getBody();
if (body != null) {
EntityData data = (EntityData) body.getUserData();
if (data.isFlaggedForDelete()) {
final Array<JointEdge> list = body.getJointList();
//delete all joints attached
while (list.size > 0) {
myWorld.getWorld().destroyJoint(list.get(0).joint);
}
//nullify everything, remove the entity from entities and destroy the body
body.setUserData(null);
myWorld.getWorld().destroyBody(body);
entities.remove(entity);
body = null;
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!