private void dumpScene(Spatial s, int indent) { System.err.println(indentString.substring(0, indent) + s.getName() + " (" + s.getClass().getSimpleName() + ") / " + s.getLocalTransform().getTranslation().toString() + ", " + s.getLocalTransform().getRotation().toString() + ", " + s.getLocalTransform().getScale().toString()); if (s instanceof Node) { Node n = (Node) s; for (Spatial spatial : n.getChildren()) { dumpScene(spatial, indent + 1); } } } }
private void dumpScene(Spatial s, int indent) { System.err.println(indentString.substring(0, indent) + s.getName() + " (" + s.getClass().getSimpleName() + ") / " + s.getLocalTransform().getTranslation().toString() + ", " + s.getLocalTransform().getRotation().toString() + ", " + s.getLocalTransform().getScale().toString()); if (s instanceof Node) { Node n = (Node) s; for (Spatial spatial : n.getChildren()) { dumpScene(spatial, indent + 1); } } } }
/** * Calculate the correct transform for a collision shape relative to the * ancestor for which the shape was generated. * * @param spat * @param parent * @return a new instance (not null) */ private static Transform getTransform(Spatial spat, Spatial parent) { Transform shapeTransform = new Transform(); Spatial parentNode = spat.getParent() != null ? spat.getParent() : spat; Spatial currentSpatial = spat; //if we have parents combine their transforms while (parentNode != null) { if (parent == currentSpatial) { //real parent -> only apply scale, not transform Transform trans = new Transform(); trans.setScale(currentSpatial.getLocalScale()); shapeTransform.combineWithParent(trans); parentNode = null; } else { shapeTransform.combineWithParent(currentSpatial.getLocalTransform()); parentNode = currentSpatial.getParent(); currentSpatial = parentNode; } } return shapeTransform; }
/** * Calculate the correct transform for a collision shape relative to the * ancestor for which the shape was generated. * * @param spat * @param parent * @return a new instance (not null) */ private static Transform getTransform(Spatial spat, Spatial parent) { Transform shapeTransform = new Transform(); Spatial parentNode = spat.getParent() != null ? spat.getParent() : spat; Spatial currentSpatial = spat; //if we have parents combine their transforms while (parentNode != null) { if (parent == currentSpatial) { //real parent -> only apply scale, not transform Transform trans = new Transform(); trans.setScale(currentSpatial.getLocalScale()); shapeTransform.combineWithParent(trans); parentNode = null; } else { shapeTransform.combineWithParent(currentSpatial.getLocalTransform()); parentNode = currentSpatial.getParent(); currentSpatial = parentNode; } } return shapeTransform; }
Transform localTransform = loopSpatial.getLocalTransform(); combined.combineWithParent(localTransform); loopSpatial = loopSpatial.getParent();
vTrack.setTransform(frame, spatial.getLocalTransform());
Transform localTransform = loopSpatial.getLocalTransform(); combined.combineWithParent(localTransform); loopSpatial = loopSpatial.getParent();
switch (space) { case CONSTRAINT_SPACE_LOCAL: return feature.getLocalTransform(); case CONSTRAINT_SPACE_WORLD: return feature.getWorldTransform();
switch (space) { case CONSTRAINT_SPACE_LOCAL: feature.getLocalTransform().set(transform); break; case CONSTRAINT_SPACE_WORLD:
public static void printSubmeshes(Spatial spatial) { System.out.println(spatial.getName() + " " + spatial.getLocalTransform()); // spatial.setLocalTranslation(spatial.getLocalTranslation().mult(0.5f)); if (spatial instanceof Node) { List<Spatial> spatials = ((Node) spatial).getChildren(); for (Spatial child : spatials) { printSubmeshes(child); } } }
public static void printSubmeshes(Spatial spatial) { System.out.println(spatial.getName() + " " + spatial.getLocalTransform()); // spatial.setLocalTranslation(spatial.getLocalTranslation().mult(0.5f)); if (spatial instanceof Node) { List<Spatial> spatials = ((Node) spatial).getChildren(); for (Spatial child : spatials) { printSubmeshes(child); } } }
/** * returns the correct transform for a collisionshape in relation * to the ancestor for which the collisionshape is generated * @param spat * @param parent * @return */ private static Transform getTransform(Spatial spat, Spatial parent) { Transform shapeTransform = new Transform(); Spatial parentNode = spat.getParent() != null ? spat.getParent() : spat; Spatial currentSpatial = spat; //if we have parents combine their transforms while (parentNode != null) { if (parent == currentSpatial) { //real parent -> only apply scale, not transform Transform trans = new Transform(); trans.setScale(currentSpatial.getLocalScale()); shapeTransform.combineWithParent(trans); parentNode = null; } else { shapeTransform.combineWithParent(currentSpatial.getLocalTransform()); parentNode = currentSpatial.getParent(); currentSpatial = parentNode; } } return shapeTransform; }
/** * Calculate the correct transform for a collision shape relative to the * ancestor for which the shape was generated. * * @param spat * @param parent * @return a new instance (not null) */ private static Transform getTransform(Spatial spat, Spatial parent) { Transform shapeTransform = new Transform(); Spatial parentNode = spat.getParent() != null ? spat.getParent() : spat; Spatial currentSpatial = spat; //if we have parents combine their transforms while (parentNode != null) { if (parent == currentSpatial) { //real parent -> only apply scale, not transform Transform trans = new Transform(); trans.setScale(currentSpatial.getLocalScale()); shapeTransform.combineWithParent(trans); parentNode = null; } else { shapeTransform.combineWithParent(currentSpatial.getLocalTransform()); parentNode = currentSpatial.getParent(); currentSpatial = parentNode; } } return shapeTransform; }
/** * Update the local transform of the attachments node. */ private void updateAttachNode() { Node attachParent = attachNode.getParent(); if (attachParent == null || targetGeometry == null || targetGeometry.getParent() == attachParent && targetGeometry.getLocalTransform().isIdentity()) { /* * The animated meshes are in the same coordinate system as the * attachments node: no further transforms are needed. */ attachNode.setLocalTranslation(modelPos); attachNode.setLocalRotation(modelRot); attachNode.setLocalScale(modelScale); } else { Spatial loopSpatial = targetGeometry; Transform combined = new Transform(modelPos, modelRot, modelScale); /* * Climb the scene graph applying local transforms until the * attachments node's parent is reached. */ while (loopSpatial != attachParent && loopSpatial != null) { Transform localTransform = loopSpatial.getLocalTransform(); combined.combineWithParent(localTransform); loopSpatial = loopSpatial.getParent(); } attachNode.setLocalTransform(combined); } }
subchild.setLocalTransform(child.getLocalTransform());
subchild.setLocalTransform(child.getLocalTransform());