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

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

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

Spatial.setLocalScale介绍

[英]setLocalScale sets the local scale of this node.
[中]setLocalScale设置此节点的本地比例。

代码示例

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

private void randomizeTransform(Spatial spat){
  spat.setLocalTranslation((float) Math.random() * 10, (float) Math.random() * 10, (float) Math.random() * 10);
  spat.setLocalTranslation((float) Math.random() * 10, (float) Math.random() * 10, (float) Math.random() * 10);
  spat.setLocalScale((float) Math.random() * 2, (float) Math.random() * 2, (float) Math.random() * 2);
}

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

private Spatial loadModel(int i) {
  Spatial model = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
  model.setLocalScale(0.1f);
  AnimComposer composer = model.getControl(AnimComposer.class);
  composer.setCurrentAction(animNames[i]);
  SkinningControl skinningControl = model.getControl(SkinningControl.class);
  skinningControl.setHardwareSkinningPreferred(hwSkinningEnable);
  skControls.add(skinningControl);
  rootNode.attachChild(model);
  return model;
}

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

public void setupSignpost() {
  Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml");
  Material mat = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m");
  signpost.setMaterial(mat);
  signpost.rotate(0, FastMath.HALF_PI, 0);
  signpost.setLocalTranslation(12, 3.5f, 30);
  signpost.setLocalScale(4);
  signpost.setShadowMode(ShadowMode.CastAndReceive);
  rootNode.attachChild(signpost);
}

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

public void setupSignpost(){
  Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml");
  Material mat = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m");
  signpost.setMaterial(mat);
  signpost.rotate(0, FastMath.HALF_PI, 0);
  signpost.setLocalTranslation(12, 3.5f, 30);
  signpost.setLocalScale(4);
  signpost.setShadowMode(ShadowMode.CastAndReceive);
  rootNode.attachChild(signpost);
}

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

public void setupSignpost(){
  Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml");
  Material mat = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m");
 //   mat.setBoolean("VertexLighting", true);
  signpost.setMaterial(mat);
  signpost.rotate(0, FastMath.HALF_PI, 0);
  signpost.setLocalTranslation(12, 3.5f, 30);
  signpost.setLocalScale(4);
  signpost.setShadowMode(ShadowMode.CastAndReceive);
  TangentBinormalGenerator.generate(signpost);
  rootNode.attachChild(signpost);
}

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

public void setupSignpost() {
  Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml");
  Material matSp = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m");
  TangentBinormalGenerator.generate(signpost);
  signpost.setMaterial(matSp);
  signpost.rotate(0, FastMath.HALF_PI, 0);
  signpost.setLocalTranslation(12, 23.5f, 30);
  signpost.setLocalScale(4);
  signpost.setShadowMode(ShadowMode.CastAndReceive);
  rootNode.attachChild(signpost);
}

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

public void setupSignpost() {
  Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml");
  Material mat = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m");
  TangentBinormalGenerator.generate(signpost);
  signpost.setMaterial(mat);
  signpost.rotate(0, FastMath.HALF_PI, 0);
  signpost.setLocalTranslation(12, 23.5f, 30);
  signpost.setLocalScale(4);
  signpost.setShadowMode(ShadowMode.CastAndReceive);
  rootNode.attachChild(signpost);
}

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

public void setupSignpost() {
  Spatial signpost = assetManager.loadModel("Models/Sign Post/Sign Post.mesh.xml");
  Material mat = assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m");
  //   mat.setBoolean("VertexLighting", true);
  signpost.setMaterial(mat);
  signpost.rotate(0, FastMath.HALF_PI, 0);
  signpost.setLocalTranslation(12, 3.5f, 30);
  signpost.setLocalScale(4);
  signpost.setShadowMode(ShadowMode.CastAndReceive);
  TangentBinormalGenerator.generate(signpost);
  rootNode.attachChild(signpost);
}

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

private void reset() {
  // Reset the pickups
  for(Spatial pickUp : pickUps.getChildren()) {
    GhostControl pickUpControl = pickUp.getControl(GhostControl.class);
    if(pickUpControl != null) {
      pickUpControl.setEnabled(true);
    }
    pickUp.setLocalScale(1.0f);
  }
  // Reset the player
  player.setPhysicsLocation(PLAYER_START.clone());
  player.setAngularVelocity(Vector3f.ZERO.clone());
  player.setLinearVelocity(Vector3f.ZERO.clone());
  // Reset the score
  score = 0;
  // Reset the message
  messageText.setLocalScale(0.0f);
}

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

@Override
public void simpleInitApp() {
  stateManager.attach(bulletAppState);
  initCrossHair();
  Spatial s = assetManager.loadModel("Models/Elephant/Elephant.mesh.xml");
  s.setLocalScale(0.1f);
  CollisionShape collisionShape = CollisionShapeFactory.createMeshShape(s);
  Node n = new Node("elephant");
  n.addControl(new RigidBodyControl(collisionShape, 1));
  n.getControl(RigidBodyControl.class).setKinematic(true);
  bulletAppState.getPhysicsSpace().add(n);
  rootNode.attachChild(n);
  bulletAppState.setDebugEnabled(true);
}

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

@Override
public void simpleInitApp() {
  initInput();
  initScene();
  //create processor
  waterProcessor = new SimpleWaterProcessor(assetManager);
  waterProcessor.setReflectionScene(sceneNode);
  waterProcessor.setDebug(true);
  viewPort.addProcessor(waterProcessor);
  waterProcessor.setLightPosition(lightPos);
  //create water quad
  //waterPlane = waterProcessor.createWaterGeometry(100, 100);
  waterPlane=(Spatial)  assetManager.loadModel("Models/WaterTest/WaterTest.mesh.xml");
  waterPlane.setMaterial(waterProcessor.getMaterial());
  waterPlane.setLocalScale(40);
  waterPlane.setLocalTranslation(-5, 0, 5);
  rootNode.attachChild(waterPlane);
}

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

n.getChild(1).setLocalScale(probe.getArea().getRadius());
  break;
default:

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

@Override
public void simpleInitApp() {
  flyCam.setMoveSpeed(10f);
  flyCam.setDragToRotate(true);
  setPauseOnLostFocus(false);
  cam.setLocation(new Vector3f(24.746134f, 13.081396f, 32.72753f));
  cam.setRotation(new Quaternion(-0.06867662f, 0.92435044f, -0.19981281f, -0.31770203f));
  makeHudText();
  DirectionalLight dl = new DirectionalLight();
  dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
  dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));
  rootNode.addLight(dl);
  for (int i = 0; i < SIZE; i++) {
    for (int j = 0; j < SIZE; j++) {
      Spatial model = (Spatial) assetManager.loadModel("Models/Oto/OtoOldAnim.j3o");
      model.setLocalScale(0.1f);
      model.setLocalTranslation(i - SIZE / 2, 0, j - SIZE / 2);
      control = model.getControl(AnimControl.class);
      channel = control.createChannel();
      channel.setAnim(animNames[(i + j) % 4]);
      SkeletonControl skeletonControl = model.getControl(SkeletonControl.class);
      skeletonControl.setHardwareSkinningPreferred(hwSkinningEnable);
      skControls.add(skeletonControl);
      rootNode.attachChild(model);
    }
  }
  inputManager.addListener(this, "toggleHWS");
  inputManager.addMapping("toggleHWS", new KeyTrigger(KeyInput.KEY_SPACE));
}

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

HttpZipLocator.class);
sceneModel = assetManager.loadModel("main.scene");
sceneModel.setLocalScale(2f);

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

throw new RuntimeException();
teapot.setLocalScale(2f);
Material mat = assetManager.loadMaterial("Textures/BumpMapTest/Tangent.j3m");
teapot.setMaterial(mat);

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

private void createScene() {
  Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
  mat.setFloat("Shininess", 1f);
  mat.setBoolean("UseMaterialColors", true);
  mat.setColor("Ambient", ColorRGBA.Black);
  mat.setColor("Diffuse", ColorRGBA.DarkGray);
  mat.setColor("Specular", ColorRGBA.White.mult(0.6f));
  Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
  matSoil.setBoolean("UseMaterialColors", true);
  matSoil.setColor("Ambient", ColorRGBA.Gray);
  matSoil.setColor("Diffuse", ColorRGBA.Gray);
  matSoil.setColor("Specular", ColorRGBA.Black);
  teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
  teapot.setLocalScale(3);
  teapot.setMaterial(mat);
  rootNode.attachChild(teapot);
  Geometry soil = new Geometry("soil", new Box(50, 1, 50));
  soil.setLocalTranslation(0, -1, 0);
  soil.setMaterial(matSoil);
  rootNode.attachChild(soil);
  DirectionalLight light = new DirectionalLight();
  light.setDirection(new Vector3f(0, -1, 0).normalizeLocal());
  light.setColor(ColorRGBA.White.mult(1.5f));
  rootNode.addLight(light);
}

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

@Override
public void simpleInitApp() {
  flyCam.setMoveSpeed(10f);
  cam.setLocation(new Vector3f(6.4f, 7.5f, 12.8f));
  cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f));
  DirectionalLight dl = new DirectionalLight();
  dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());
  dl.setColor(ColorRGBA.White);
  rootNode.addLight(dl);
  Spatial model = assetManager.loadModel("Models/Jaime/Jaime.j3o");
  control = model.getControl(AnimControl.class);
  SkeletonControl skeletonControl = model.getControl(SkeletonControl.class);
  model.center();
  model.setLocalScale(5f);
  control.addListener(this);
  channel = control.createChannel();
  channel.setAnim("Idle");
  Box box = new Box(0.3f, 0.02f, 0.02f);
  Geometry saber = new Geometry("saber", box);
  saber.move(0.4f, 0.05f, 0.01f);
  Material red = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
  saber.setMaterial(red);
  Node n = skeletonControl.getAttachmentsNode("hand.R");
  n.attachChild(saber);
  rootNode.attachChild(model);
  inputManager.addListener(this, "Attack");
  inputManager.addMapping("Attack", new KeyTrigger(KeyInput.KEY_SPACE));
}

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

private void createScene() {
  Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
  mat.setFloat("Shininess", 1f);
  mat.setBoolean("UseMaterialColors", true);
  mat.setColor("Ambient", ColorRGBA.Black);
  mat.setColor("Diffuse", ColorRGBA.DarkGray);
  mat.setColor("Specular", ColorRGBA.White.mult(0.6f));
  Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
  matSoil.setBoolean("UseMaterialColors", true);
  matSoil.setColor("Ambient", ColorRGBA.Black);
  matSoil.setColor("Diffuse", ColorRGBA.Black);
  matSoil.setColor("Specular", ColorRGBA.Black);
  teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
  teapot.setName("Teapot");
  teapot.setLocalScale(3);
  teapot.setMaterial(mat);
  rootNode.attachChild(teapot);
  Geometry soil = new Geometry("soil", new Box(50, 1, 50));
  soil.setLocalTranslation(0, -1, 0);
  soil.setMaterial(matSoil);
  rootNode.attachChild(soil);
  DirectionalLight light = new DirectionalLight();
  light.setDirection(new Vector3f(0, -1, 0).normalizeLocal());
  light.setColor(ColorRGBA.White.mult(1.5f));
  rootNode.addLight(light);
}

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

&& pickUpControl.getOverlappingCount() > 1) {
pickUpControl.setEnabled(false);
pickUp.setLocalScale(0f);
++score;
if (score >= PICKUP_COUNT) {

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

scene.setMaterial(mat);
scene.setShadowMode(ShadowMode.CastAndReceive);
scene.setLocalScale(400);
scene.setLocalTranslation(0, -10, -120);

相关文章

Spatial类方法