本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.model.Node.hasChildren方法的典型用法代码示例。如果您正苦于以下问题:Java Node.hasChildren方法的具体用法?Java Node.hasChildren怎么用?Java Node.hasChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g3d.model.Node
的用法示例。
在下文中一共展示了Node.hasChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawArmatureNodes
import com.badlogic.gdx.graphics.g3d.model.Node; //导入方法依赖的package包/类
private void drawArmatureNodes(Node currentNode, Vector3 modelPos,
Quaternion modelRot,
Vector3 parentNodePos, Vector3 currentNodePos) {
currentNode.globalTransform.getTranslation(currentNodePos);
modelRot.transform(currentNodePos);
currentNodePos.add(modelPos);
drawVertex(currentNodePos, 0.02f, Color.GREEN);
shapeRenderer.setColor(Color.YELLOW);
if (currentNode.hasParent()) {
shapeRenderer.line(parentNodePos, currentNodePos);
}
if (currentNode.hasChildren()) {
float x = currentNodePos.x;
float y = currentNodePos.y;
float z = currentNodePos.z;
for (Node child : currentNode.getChildren()) {
drawArmatureNodes(child, modelPos, modelRot, currentNodePos, parentNodePos);
currentNodePos.set(x, y, z);
}
}
}
示例2: getBoneDirection
import com.badlogic.gdx.graphics.g3d.model.Node; //导入方法依赖的package包/类
/**
* Direction vector of an armature bone, in world coordinate system.
*
* @param nodeId Name of the bone
* @param out Output vector
* @return Output vector for chaining
*/
public Vector3 getBoneDirection(String nodeId, Vector3 out) {
Node node = modelInstance.getNode(nodeId);
Node endPointNode = (node.hasChildren()) ? node.getChild(0) : node;
node.globalTransform.getTranslation(TMP_V1);
endPointNode.globalTransform.getTranslation(TMP_V2);
TMP_V1.sub(TMP_V2).scl(-1);
modelInstance.transform.getRotation(TMP_Q);
TMP_Q.transform(TMP_V1);
return out.set(TMP_V1).nor();
}
示例3: getBoneMidpointWorldPosition
import com.badlogic.gdx.graphics.g3d.model.Node; //导入方法依赖的package包/类
/**
* Midpoint of an armature bone, in world coordinate system.
*
* @param nodeId Name of the bone
* @param out Output vector
* @return Output vector for chaining
*/
public Vector3 getBoneMidpointWorldPosition(String nodeId, Vector3 out) {
Node node = modelInstance.getNode(nodeId);
Node endPointNode = (node.hasChildren()) ? node.getChild(0) : node;
// Use global transform to account for model scaling
node.globalTransform.getTranslation(TMP_V1);
TMP_V3.set(TMP_V1);
endPointNode.globalTransform.getTranslation(TMP_V2);
TMP_V3.sub(TMP_V1.sub(TMP_V2).scl(0.5f));
modelInstance.transform.getRotation(TMP_Q, true).transform(TMP_V3);
TMP_V3.add(getPosition());
return out.set(TMP_V3);
}