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

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

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

Spatial.setUserData介绍

暂无

代码示例

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

/**
 * The method applies properties to the given spatial. The Properties
 * instance cannot be directly applied because the end-user might not have
 * the blender plugin jar file and thus receive ClassNotFoundException. The
 * values are set by name instead.
 * 
 * @param spatial
 *            the spatial that is to have properties applied
 * @param properties
 *            the properties to be applied
 */
public void applyProperties(Spatial spatial, Properties properties) {
  List<String> propertyNames = properties.getSubPropertiesNames();
  if (propertyNames != null && propertyNames.size() > 0) {
    for (String propertyName : propertyNames) {
      Object value = properties.findValue(propertyName);
      if (value instanceof Savable || value instanceof Boolean || value instanceof String || value instanceof Float || value instanceof Integer || value instanceof Long) {
        spatial.setUserData(propertyName, value);
      } else if (value instanceof Double) {
        spatial.setUserData(propertyName, ((Double) value).floatValue());
      } else if (value instanceof int[]) {
        spatial.setUserData(propertyName, Arrays.toString((int[]) value));
      } else if (value instanceof float[]) {
        spatial.setUserData(propertyName, Arrays.toString((float[]) value));
      } else if (value instanceof double[]) {
        spatial.setUserData(propertyName, Arrays.toString((double[]) value));
      }
    }
  }
}

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

translation.y = (smoothstep(0, 1, val) * 2.5f) - 1.25f;
child.setUserData("height", val);
child.setUserData("dir", dir);

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

spatial.setUserData(userDataEntry.getKey(), userDataEntry.getValue());

代码示例来源:origin: jMonkeyEngine-Contributions/Lemur

public static void setLayer( Spatial s, int layer ) {
  if( layer == 0 ) {
    s.setUserData(LAYER, null);
  } else {        
    s.setUserData(LAYER, layer);
  }
}

代码示例来源:origin: tonihele/OpenKeeper

@Override
public void setSpatial(Spatial spatial) {
  super.setSpatial(spatial);
  if (spatial != null) {
    plug = ((Node) spatial).getChild("plug");
    plugDecay = (Node) ((Node) spatial).getChild("plug_decay");
    for (Spatial piece : plugDecay.getChildren()) {
      piece.setUserData("rotate", FastMath.rand.nextFloat());
      piece.setUserData("velocity", velocity * FastMath.rand.nextFloat());
    }
  }
}

代码示例来源:origin: jMonkeyEngine-Contributions/Lemur

public static void clearEffectiveLayer( Spatial s ) {
  s.setUserData(EFFECTIVE_LAYER, null);
  if( s instanceof Node ) {
    for( Spatial child : ((Node)s).getChildren() ) {
      clearEffectiveLayer(child);
    }
  }
}

代码示例来源:origin: tonihele/OpenKeeper

protected void lockDoor() {
  locked = true;
  if (lockSpatial == null && lockObject != null) {
    lockSpatial = AssetUtils.loadModel(assetManager, lockObject.getMeshResource().getName());
    lockSpatial.setUserData(AssetUtils.USER_DATA_KEY_REMOVABLE, false);
    ((Node) getSpatial()).attachChild(lockSpatial);
  }
  closeDoor();
}

代码示例来源:origin: tonihele/OpenKeeper

protected Spatial getFlower() {
  if (spatial == null) {
    updateRequired = false;
    Mesh mesh = createMesh(0.5f, 0.5f);
    spatial = new Geometry("Health indicator", mesh);
    material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    Color c = MapThumbnailGenerator.getPlayerColor(getOwnerId());
    material.setColor("Color", new ColorRGBA(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, c.getAlpha() / 255f));
    spatial.setMaterial(material);
    material.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
    material.getAdditionalRenderState().setDepthTest(false);
    spatial.setQueueBucket(Bucket.Translucent);
    spatial.setUserData(AssetUtils.USER_DATA_KEY_REMOVABLE, false);
    generateTexture();
  }
  return spatial;
}

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

spatial.setUserData(userDataEntry.getKey(), userDataEntry.getValue());

代码示例来源:origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport-jmonkey

object.setUserData("Animation", false);
Spatial usedObject = object;
if(object.getControl(AnimControl.class) == null){

代码示例来源:origin: tonihele/OpenKeeper

@Override
protected void controlUpdate(float tpf) {
  // TODO add normal physics control
  if (tick > 11) {
    plugDecay.removeFromParent();
    spatial.removeControl(this);
  } else if (tick > 9) {
    velocity -= GRAVITY * tpf;
    for (Spatial piece : plugDecay.getChildren()) {
      float rotate = (float) piece.getUserData("rotate") * 10 * tpf;
      float pv = (float) piece.getUserData("velocity") - GRAVITY * tpf;
      piece.setUserData("velocity", pv);
      piece.move(0, pv * tpf, 0);
      //float step = (float) piece.getUserData("yAngle");
      //piece.move(tpf * FastMath.cos(step), velocity * tpf, tpf * FastMath.sin(step));
      piece.rotate(rotate, rotate, rotate);
    }
  } else if (tick > 6) {
    plug.removeFromParent();
    plugDecay.setCullHint(Spatial.CullHint.Inherit);
  }
  tick += tpf;
}

代码示例来源:origin: tonihele/OpenKeeper

piece.setUserData("yAngle", step);
plug.attachChild(piece);

相关文章

Spatial类方法