本文整理了Java中com.jme3.scene.Geometry.rotate()
方法的一些代码示例,展示了Geometry.rotate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.rotate()
方法的具体详情如下:
包路径:com.jme3.scene.Geometry
类名称:Geometry
方法名:rotate
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void simpleUpdate(float tpf) {
// make the player rotate:
player.rotate(0, 2*tpf, 0);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void onAnalog(String name, float value, float tpf) {
if (isRunning) {
if (name.equals("Rotate")) {
player.rotate(0, value, 0);
}
if (name.equals("Right")) {
player.move((new Vector3f(value, 0,0)) );
}
if (name.equals("Left")) {
player.move(new Vector3f(-value, 0,0));
}
} else {
System.out.println("Press P to unpause.");
}
}
};
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void update(){
super.update();
// do some animation
float tpf = timer.getTimePerFrame();
boxGeom.rotate(tpf * 2, tpf * 4, tpf * 3);
// dont forget to update the scenes
boxGeom.updateLogicalState(tpf);
boxGeom.updateGeometricState();
// render the viewports
renderManager.render(tpf, context.isRenderable());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void addBrick(Vector3f ori) {
Geometry reBoxg = new Geometry("brick", brick);
reBoxg.setMaterial(mat);
reBoxg.setLocalTranslation(ori);
reBoxg.rotate(0f, (float)Math.toRadians(angle) , 0f );
reBoxg.addControl(new RigidBodyControl(1.5f));
reBoxg.setShadowMode(ShadowMode.CastAndReceive);
reBoxg.getControl(RigidBodyControl.class).setFriction(1.6f);
this.rootNode.attachChild(reBoxg);
this.getPhysicsSpace().add(reBoxg);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void addBrick(Vector3f ori) {
Geometry reBoxg = new Geometry("brick", brick);
reBoxg.setMaterial(mat);
reBoxg.setLocalTranslation(ori);
reBoxg.rotate(0f, (float)Math.toRadians(angle) , 0f );
reBoxg.addControl(new RigidBodyControl(1.5f));
reBoxg.setShadowMode(ShadowMode.CastAndReceive);
reBoxg.getControl(RigidBodyControl.class).setFriction(1.6f);
this.batchNode.attachChild(reBoxg);
this.getPhysicsSpace().add(reBoxg);
nbBrick++;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Test
public void testCylinders() {
Random random = new Random();
// Create a cylinder, cast a random ray, and ensure everything goes well.
Node scene = new Node("Scene Node");
for (int i = 0; i < NUMBER_OF_TRIES; i++) {
scene.detachAllChildren();
Cylinder cylinder = new Cylinder(2, 8, 1, 1, true);
Geometry geometry = new Geometry("cylinder", cylinder);
geometry.rotate(FastMath.HALF_PI, 0, 0);
scene.attachChild(geometry);
// Cast a random ray, and count successes and IndexOutOfBoundsExceptions.
Vector3f randomPoint = new Vector3f(random.nextFloat(), random.nextFloat(), random.nextFloat());
Vector3f randomDirection = new Vector3f(random.nextFloat(), random.nextFloat(), random.nextFloat());
randomDirection.normalizeLocal();
Ray ray = new Ray(randomPoint, randomDirection);
CollisionResults collisionResults = new CollisionResults();
// If the geometry is invalid, this should throw various exceptions.
scene.collideWith(ray, collisionResults);
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void setupFloor() {
Quad q = new Quad(20, 20);
q.scaleTextureCoordinates(Vector2f.UNIT_XY.mult(10));
Geometry geom = new Geometry("floor", q);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.White);
geom.setMaterial(mat);
geom.rotate(-FastMath.HALF_PI, 0, 0);
geom.center();
geom.move(0, -0.3f, 0);
geom.setShadowMode(RenderQueue.ShadowMode.Receive);
rootNode.attachChild(geom);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void setupFloor() {
Quad q = new Quad(20, 20);
q.scaleTextureCoordinates(Vector2f.UNIT_XY.mult(10));
Geometry geom = new Geometry("floor", q);
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat.setColor("Diffuse", ColorRGBA.White);
mat.setColor("Specular", ColorRGBA.White);
mat.setColor("Ambient", ColorRGBA.Black);
mat.setBoolean("UseMaterialColors", true);
mat.setFloat("Shininess", 0);
geom.setMaterial(mat);
geom.rotate(-FastMath.HALF_PI, 0, 0);
geom.center();
geom.setShadowMode(RenderQueue.ShadowMode.Receive);
rootNode.attachChild(geom);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void simpleInitApp() {
maxAniso = renderer.getLimits().get(Limits.TextureAnisotropy);
flyCam.setDragToRotate(true);
flyCam.setMoveSpeed(100);
cam.setLocation(new Vector3f(197.02617f, 4.6769195f, -194.89545f));
cam.setRotation(new Quaternion(0.07921988f, 0.8992258f, -0.18292196f, 0.38943136f));
Quad q = new Quad(1000, 1000);
q.scaleTextureCoordinates(new Vector2f(1000, 1000));
Geometry geom = new Geometry("quad", q);
geom.rotate(-FastMath.HALF_PI, 0, 0);
geom.setMaterial(createCheckerBoardMaterial(assetManager));
rootNode.attachChild(geom);
inputManager.addMapping("higher", new KeyTrigger(KeyInput.KEY_1));
inputManager.addMapping("lower", new KeyTrigger(KeyInput.KEY_2));
inputManager.addListener(this, "higher");
inputManager.addListener(this, "lower");
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void simpleInitApp() {
flyCam.setMoveSpeed(10);
Torus torus = new Torus(10, 6, 1, 3);
Geometry g = new Geometry("Torus Geom", torus);
g.rotate(-FastMath.HALF_PI, 0, 0);
g.center();
g.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
// rootNode.attachChild(g);
ufoNode = new AudioNode(assetManager, "Sound/Effects/Beep.ogg", AudioData.DataType.Buffer);
ufoNode.setLooping(true);
ufoNode.setPitch(0.5f);
ufoNode.setRefDistance(1);
ufoNode.setMaxDistance(100000000);
ufoNode.setVelocityFromTranslation(true);
ufoNode.play();
Geometry ball = new Geometry("Beeper", new Sphere(10, 10, 0.1f));
ball.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
ufoNode.attachChild(ball);
rootNode.attachChild(ufoNode);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
Geometry wheels1 = new Geometry("wheel 1", wheelMesh);
node1.attachChild(wheels1);
wheels1.rotate(0, FastMath.HALF_PI, 0);
wheels1.setMaterial(mat);
vehicle.addWheel(node1, new Vector3f(-xOff, yOff, zOff),
Geometry wheels2 = new Geometry("wheel 2", wheelMesh);
node2.attachChild(wheels2);
wheels2.rotate(0, FastMath.HALF_PI, 0);
wheels2.setMaterial(mat);
vehicle.addWheel(node2, new Vector3f(xOff, yOff, zOff),
Geometry wheels3 = new Geometry("wheel 3", wheelMesh);
node3.attachChild(wheels3);
wheels3.rotate(0, FastMath.HALF_PI, 0);
wheels3.setMaterial(mat);
vehicle.addWheel(node3, new Vector3f(-xOff, yOff, -zOff),
Geometry wheels4 = new Geometry("wheel 4", wheelMesh);
node4.attachChild(wheels4);
wheels4.rotate(0, FastMath.HALF_PI, 0);
wheels4.setMaterial(mat);
vehicle.addWheel(node4, new Vector3f(xOff, yOff, -zOff),
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
aGeometry.rotate(FastMath.QUARTER_PI, FastMath.QUARTER_PI, 0.0f);
rootNode.attachChild(aGeometry);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
g.rotate(-FastMath.HALF_PI, 0, 0);
g.center();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
g.rotate(-FastMath.HALF_PI, 0, 0);
g.center();
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
Geometry wheels1 = new Geometry("wheel 1", wheelMesh);
node1.attachChild(wheels1);
wheels1.rotate(0, FastMath.HALF_PI, 0);
wheels1.setMaterial(mat);
vehicle.addWheel(node1, new Vector3f(-xOff, yOff, zOff),
Geometry wheels2 = new Geometry("wheel 2", wheelMesh);
node2.attachChild(wheels2);
wheels2.rotate(0, FastMath.HALF_PI, 0);
wheels2.setMaterial(mat);
vehicle.addWheel(node2, new Vector3f(xOff, yOff, zOff),
Geometry wheels3 = new Geometry("wheel 3", wheelMesh);
node3.attachChild(wheels3);
wheels3.rotate(0, FastMath.HALF_PI, 0);
wheels3.setMaterial(mat);
vehicle.addWheel(node3, new Vector3f(-xOff, yOff, -zOff),
Geometry wheels4 = new Geometry("wheel 4", wheelMesh);
node4.attachChild(wheels4);
wheels4.rotate(0, FastMath.HALF_PI, 0);
wheels4.setMaterial(mat);
vehicle.addWheel(node4, new Vector3f(xOff, yOff, -zOff),
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
sphereGeo.rotate(1.6f, 0, 0); // Rotate it a bit
rootNode.attachChild(sphereGeo);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
geom.setMaterial(mat);
geom.rotate(-FastMath.HALF_PI, 0, 0);
geom.center();
geom.setShadowMode(ShadowMode.Receive);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
geom.setMaterial(mat);
geom.rotate(-FastMath.HALF_PI, 0, 0);
geom.center();
geom.setShadowMode(ShadowMode.Receive);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
ln.attachChild(geom);
geom.setLocalTranslation(0, -spotLight.getSpotRange() / 2f, 0);
geom.rotate(-FastMath.HALF_PI, 0, 0);
rootNode.attachChild(ln);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
geom.setMaterial(mat);
geom.rotate(-FastMath.HALF_PI, 0, 0);
geom.center();
geom.setShadowMode(ShadowMode.CastAndReceive);
内容来源于网络,如有侵权,请联系作者删除!