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

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

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

Spatial.getName介绍

[英]Returns the name of this spatial.
[中]返回此空间文件的名称。

代码示例

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration) {
  super(initialDuration);
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 * @param channelIndex the index of the channel default is 0. Events on the
 * same channelIndex will use the same channel.
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration, int channelIndex) {
  super(initialDuration);
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
  this.channelIndex = channelIndex;
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 * @param blendTime the time during the animation are gonna be blended
 * @see AnimChannel#setAnim(java.lang.String, float)
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration, float blendTime) {
  super(initialDuration);
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
  this.blendTime = blendTime;
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 * @param loopMode the loopMode
 * @see LoopMode
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration, LoopMode loopMode) {
  super(initialDuration, loopMode);
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 * @param loopMode the loopMode
 * @see LoopMode
 * @param blendTime the time during the animation are gonna be blended
 * @see AnimChannel#setAnim(java.lang.String, float)
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration, LoopMode loopMode, float blendTime) {
  super(initialDuration, loopMode);
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
  this.blendTime = blendTime;
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 * @param loopMode the loopMode
 * @see LoopMode
 * @param channelIndex the index of the channel default is 0. Events on the
 * same channelIndex will use the same channel.
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration, LoopMode loopMode, int channelIndex) {
  super(initialDuration, loopMode);
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
  this.channelIndex = channelIndex;
}

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

public void collision(PhysicsCollisionEvent event) {
  if ("Box".equals(event.getNodeA().getName()) || "Box".equals(event.getNodeB().getName())) {
    if ("bullet".equals(event.getNodeA().getName()) || "bullet".equals(event.getNodeB().getName())) {
      fpsText.setText("You hit the box!");
    }
  }
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 */
public AnimationEvent(Spatial model, String animationName) {
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
  initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param loopMode the loopMode
 * @see LoopMode
 */
public AnimationEvent(Spatial model, String animationName, LoopMode loopMode) {
  super(loopMode);
  initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param channelIndex the index of the channel default is 0. Events on the
 * same channelIndex will use the same channel.
 */
public AnimationEvent(Spatial model, String animationName, int channelIndex) {
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
  initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
  this.channelIndex = channelIndex;
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param loopMode the loopMode
 * @see LoopMode
 * @param blendTime the time during the animation are gonna be blended
 * @see AnimChannel#setAnim(java.lang.String, float)
 */
public AnimationEvent(Spatial model, String animationName, LoopMode loopMode, float blendTime) {
  super(loopMode);
  initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
  this.blendTime = blendTime;
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param loopMode the loopMode
 * @see LoopMode
 * @param channelIndex the index of the channel default is 0. Events on the
 * same channelIndex will use the same channel.
 */
public AnimationEvent(Spatial model, String animationName, LoopMode loopMode, int channelIndex) {
  super(loopMode);
  initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
  this.channelIndex = channelIndex;
}

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

/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param channelIndex the index of the channel default is 0. Events on the
 * @param blendTime the time during the animation are gonna be blended
 * same channelIndex will use the same channel.
 */
public AnimationEvent(Spatial model, String animationName, LoopMode loopMode, int channelIndex, float blendTime) {
  this.model = model;
  this.modelName = model.getName();
  this.animationName = animationName;
  this.loopMode = loopMode;
  initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
  this.channelIndex = channelIndex;
  this.blendTime = blendTime;
}

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

/**
 * <code>detachChild</code> removes a given child from the node's list.
 * This child will no longe be maintained. Only the first child with a
 * matching name is removed.
 *
 * @param childName
 *            the child to remove.
 * @return the index the child was at. -1 if the child was not in the list.
 */
public int detachChildNamed(String childName) {
  if (childName == null)
    throw new NullPointerException();
  for (int x = 0, max = children.size(); x < max; x++) {
    Spatial child =  children.get(x);
    if (childName.equals(child.getName())) {
      detachChildAt( x );
      return x;
    }
  }
  return -1;
}

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

private Geometry findGeom(Spatial spatial, String name) {
  if (spatial instanceof Node) {
    Node node = (Node) spatial;
    for (int i = 0; i < node.getQuantity(); i++) {
      Spatial child = node.getChild(i);
      Geometry result = findGeom(child, name);
      if (result != null) {
        return result;
      }
    }
  } else if (spatial instanceof Geometry) {
    if (spatial.getName().startsWith(name)) {
      return (Geometry) spatial;
    }
  }
  return null;
}

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

public void onWayPointReach(MotionEvent control, int wayPointIndex) {
    if (path.getNbWayPoints() == wayPointIndex + 1) {
      wayPointsText.setText(control.getSpatial().getName() + " Finish!!! ");
    } else {
      wayPointsText.setText(control.getSpatial().getName() + " Reached way point " + wayPointIndex);
    }
    wayPointsText.setLocalTranslation((cam.getWidth() - wayPointsText.getLineWidth()) / 2, cam.getHeight(), 0);
  }
});

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

public void onWayPointReach(MotionEvent control, int wayPointIndex) {
    if (path.getNbWayPoints() == wayPointIndex + 1) {
      wayPointsText.setText(control.getSpatial().getName() + "Finished!!! ");
    } else {
      wayPointsText.setText(control.getSpatial().getName() + " Reached way point " + wayPointIndex);
    }
    wayPointsText.setLocalTranslation((cam.getWidth() - wayPointsText.getLineWidth()) / 2, cam.getHeight(), 0);
  }
});

代码示例来源: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

@Override
public Node clone(boolean cloneMaterials) {
  BatchNode clone = (BatchNode) super.clone(cloneMaterials);
  if (batches.size() > 0) {
    for (Batch b : batches) {
      for (int i = 0; i < clone.children.size(); i++) {
        if (clone.children.get(i).getName().equals(b.geometry.getName())) {
          clone.children.remove(i);
          break;
        }
      }
    }
    clone.needsFullRebatch = true;
    clone.batches = new SafeArrayList<Batch>(Batch.class);
    clone.batchesByGeom = new HashMap<Geometry, Batch>();
    clone.batch();
  }
  return clone;
}

代码示例来源: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);
      }
    }
  }
}

相关文章

Spatial类方法