com.jme3.scene.Spatial.getLocalTransform()方法的使用及代码示例

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

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

Spatial.getLocalTransform介绍

[英]getLocalTransform retrieves the local transform of this spatial.
[中]getLocalTransform检索此空间的局部变换。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

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);
      }
    }
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

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);
      }
    }
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * 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;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * 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;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

Transform localTransform = loopSpatial.getLocalTransform();
combined.combineWithParent(localTransform);
loopSpatial = loopSpatial.getParent();

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

vTrack.setTransform(frame, spatial.getLocalTransform());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

Transform localTransform = loopSpatial.getLocalTransform();
combined.combineWithParent(localTransform);
loopSpatial = loopSpatial.getParent();

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

switch (space) {
  case CONSTRAINT_SPACE_LOCAL:
    return feature.getLocalTransform();
  case CONSTRAINT_SPACE_WORLD:
    return feature.getWorldTransform();

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

switch (space) {
  case CONSTRAINT_SPACE_LOCAL:
    feature.getLocalTransform().set(transform);
    break;
  case CONSTRAINT_SPACE_WORLD:

代码示例来源:origin: us.ihmc/IHMCJMonkeyEngineToolkit

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);
   }
 }
}

代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit

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);
   }
 }
}

代码示例来源:origin: org.jmonkeyengine/jme3-bullet

/**
 * 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;
}

代码示例来源:origin: org.jmonkeyengine/jme3-jbullet

/**
 * 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;
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * 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);
  }
}

代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit

subchild.setLocalTransform(child.getLocalTransform());

代码示例来源:origin: us.ihmc/IHMCJMonkeyEngineToolkit

subchild.setLocalTransform(child.getLocalTransform());

相关文章

Spatial类方法