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

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

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

Spatial.rotate介绍

[英]Rotates the spatial by the xAngle, yAngle and zAngle angles (in radians), (aka pitch, yaw, roll) in the local coordinate space.
[中]在局部坐标空间中按xAngle、yAngle和zAngle角度(弧度)旋转空间。

代码示例

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

@Override
protected void controlUpdate( float tpf ) {
  if( spatial != null ) {
    spatial.rotate(rotate[0] * tpf, rotate[1] * tpf, rotate[2] * tpf);
  }
}

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

@Override
public void simpleUpdate(float tpf){
  teapot.rotate(0,tpf,0);
  tracer.update();
}

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

public void setupModel(){
    Spatial model = assetManager.loadModel("Models/MonkeyHead/MonkeyHead.mesh.xml");
    makeToonish(model);
    model.rotate(0, FastMath.PI, 0);
//        signpost.setLocalTranslation(12, 3.5f, 30);
//        model.scale(0.10f);
//        signpost.setShadowMode(ShadowMode.CastAndReceive);
    rootNode.attachChild(model);
  }

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

/**
 * Rotates the spatial by the xAngle, yAngle and zAngle angles (in radians),
 * (aka pitch, yaw, roll) in the local coordinate space.
 *
 * @return The spatial on which this method is called, e.g <code>this</code>.
 */
public Spatial rotate(float xAngle, float yAngle, float zAngle) {
  TempVars vars = TempVars.get();
  Quaternion q = vars.quat1;
  q.fromAngles(xAngle, yAngle, zAngle);
  rotate(q);
  vars.release();
  return this;
}

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

if (name.equals("left")) {
  tmp.set(cam.getDirection());
  s.rotate(tmpQuat.fromAngleAxis(value, tmp));
  s.rotate(tmpQuat.fromAngleAxis(-value, tmp));

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

if (name.equals("left")) {
  tmp.set(cam.getDirection());
  s.rotate(tmpQuat.fromAngleAxis(value, tmp));
  s.rotate(tmpQuat.fromAngleAxis(-value, tmp));

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

public void makeMissile() {
  Vector3f pos = spaceCraft.getWorldTranslation().clone();
  Quaternion rot = spaceCraft.getWorldRotation();
  Vector3f dir = rot.getRotationColumn(2);
  Spatial missile = assetManager.loadModel("Models/SpaceCraft/Rocket.mesh.xml");
  missile.scale(0.5f);
  missile.rotate(0, FastMath.PI, 0);
  missile.updateGeometricState();
  BoundingBox box = (BoundingBox) missile.getWorldBound();
  final Vector3f extent = box.getExtent(null);
  BoxCollisionShape boxShape = new BoxCollisionShape(extent);
  missile.setName("Missile");
  missile.rotate(rot);
  missile.setLocalTranslation(pos.addLocal(0, extent.y * 4.5f, 0));
  missile.setLocalRotation(hoverControl.getPhysicsRotation());
  missile.setShadowMode(ShadowMode.Cast);
  RigidBodyControl control = new BombControl(assetManager, boxShape, 20);
  control.setLinearVelocity(dir.mult(100));
  control.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_03);
  missile.addControl(control);
  rootNode.attachChild(missile);
  getPhysicsSpace().add(missile);
}

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

teapot.rotate(FastMath.HALF_PI, FastMath.HALF_PI, FastMath.HALF_PI);
teapot.setMaterial(mat);
rootNode.attachChild(teapot);

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

pickUp.rotate(pickUpSpeed, pickUpSpeed, pickUpSpeed);

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

ninja.rotate(0.0f, -3.0f, 0.0f);
ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);
rootNode.attachChild(ninja);

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

@Override
protected void controlUpdate(float tpf) {
  if (spatial != null) {
    //Rotate
    spatial.rotate(0, tpf * TURN_RATE, 0);
  }
}

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

private Spatial constructPillar(Node node, Point p, float yAngle) {
  Spatial part = AssetUtils.loadModel(assetManager, getPillarResource());
  moveSpatial(part, p);
  if (yAngle != 0) {
    part.rotate(0, yAngle, 0);
  }
  node.attachChild(part);
  return part;
}

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

/**
 * Adds two candles to the tile, one to each side
 *
 * @param n node to attach to
 * @param assetManager the asset manager instance
 * @param start starting point for the room
 * @param p this tile coordinate
 */
private void addCandles(Node n, AssetManager assetManager, Point start, Point p) {
  // The "candles"
  n.attachChild(loadObject(OBJECT_CHAIN_ID, assetManager, start, p, true).move(-1f, 0, 0));
  float yAngle = -FastMath.PI;
  n.attachChild(loadObject(OBJECT_CHAIN_ID, assetManager, start, p, true)
      .rotate(0, yAngle, 0).move(1f, 0, 1f));
}

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

private void handleSide(TileData tile, Node pageNode) {
  Point p = tile.getLocation();
  Node sideTileNode = getTileNode(p, (Node) pageNode.getChild(WALL_INDEX));
  for (WallDirection direction : WallDirection.values()) {
    Spatial wall = getWallSpatial(tile, direction);
    if (wall != null) {
      wall.rotate(0, direction.getAngle(), 0);
      sideTileNode.attachChild(wall);
    }
  }
  setTileMaterialToGeometries(tile, sideTileNode);
  AssetUtils.translateToTile(sideTileNode, p);
  tile.setSideNode(sideTileNode);
}

相关文章

Spatial类方法