本文整理了Java中com.jme3.scene.Geometry.move()
方法的一些代码示例,展示了Geometry.move()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.move()
方法的具体详情如下:
包路径:com.jme3.scene.Geometry
类名称:Geometry
方法名:move
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void onAction(String name, boolean keyPressed, float tpf) {
if (name.equals("displayPosition") && keyPressed) {
teaGeom.move(10, 10, 10);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void onAction(String name, boolean keyPressed, float tpf) {
if (name.equals("displayPosition") && keyPressed) {
teaGeom.move(10, 10, 10);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void onAnalog(String name, float value, float tpf) {
if (name.equals("moveForward")) {
teaGeom.move(0, 0, -5 * tpf);
}
if (name.equals("moveBackward")) {
teaGeom.move(0, 0, 5 * tpf);
}
if (name.equals("moveRight")) {
teaGeom.move(5 * tpf, 0, 0);
}
if (name.equals("moveLeft")) {
teaGeom.move(-5 * tpf, 0, 0);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void onAnalog(String name, float value, float tpf) {
if (name.equals("moveForward")) {
teaGeom.move(0, 0, -5 * tpf);
}
if (name.equals("moveBackward")) {
teaGeom.move(0, 0, 5 * tpf);
}
if (name.equals("moveRight")) {
teaGeom.move(5 * tpf, 0, 0);
}
if (name.equals("moveLeft")) {
teaGeom.move(-5 * tpf, 0, 0);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void onAnalog(String name, float value, float tpf) {
if (name.equals("MoveRight")) {
geom1.move(2 * tpf, 0, 0);
}
if (name.equals("MoveLeft")) {
geom1.move(-2 * tpf, 0, 0);
}
if (name.equals("MoveUp")) {
geom1.move(0, 2 * tpf, 0);
}
if (name.equals("MoveDown")) {
geom1.move(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
model.move(0, tpf * 100f, 0);
model.move(0, -tpf * 100f, 0);
model.move(0, 0, tpf * 100f);
model.move(0, 0, -tpf * 100f);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void createBox(float location, ColorRGBA color) {
Geometry geom = new Geometry("Box", box);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", color);
geom.setMaterial(mat);
geom.move(location, 0, 0);
rootNode.attachChild(geom);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
} else if (binding.equals("Lefts") && !keyPressed) {
Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
selectedCollisionObject.move(-0.5f, 0, 0);
testCollision(oldLoc);
} else if (binding.equals("Rights") && !keyPressed) {
Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
selectedCollisionObject.move(0.5f, 0, 0);
testCollision(oldLoc);
} else if (binding.equals("Forwards") && !keyPressed) {
Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
selectedCollisionObject.move(0, 0, 0.5f);
testCollision(oldLoc);
} else if (binding.equals("Backs") && !keyPressed) {
Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
selectedCollisionObject.move(0, 0, -0.5f);
testCollision(oldLoc);
} else if (binding.equals("Ups") && !keyPressed) {
Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
selectedCollisionObject.move(0, 0.5f, 0);
testCollision(oldLoc);
} else if (binding.equals("Downs") && !keyPressed) {
Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
selectedCollisionObject.move(0, -0.5f, 0);
testCollision(oldLoc);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
cube1.move(0, 1.5f, 0);
cube2.move(0.2f, 0 , 0);
cube2.setQueueBucket(RenderQueue.Bucket.Transparent);
cube2.getMaterial().setColor("Color", ColorRGBA.Red);
Geometry cube4 = cube2.clone(true);
cube4.getMaterial().getAdditionalRenderState().setDepthFunc(RenderState.TestFunction.Less);
cube3.move(0,-3,0);
cube4.move(0,-3,0);
rootNode.attachChild(cube3);
rootNode.attachChild(cube4);
代码示例来源: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
@Override
public void simpleInitApp() {
Quad q = new Quad(1, 1);
Geometry g = new Geometry("quad", q);
g.setLocalTranslation(-500, -500, 0);
g.setLocalScale(1000);
rootNode.attachChild(g);
cam.setLocation(new Vector3f(0.0f, 0.0f, 0.40647888f));
cam.setRotation(new Quaternion(0.0f, 1.0f, 0.0f, 0.0f));
Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
Material mat = new Material(assetManager, "Common/MatDefs/Misc/UnshadedNodes.j3md");
//Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Yellow);
mat.setTexture("ColorMap", tex);
g.setMaterial(mat);
//place the geoms in the transparent bucket so that they are rendered back to front for maximum overdraw
g.setQueueBucket(RenderQueue.Bucket.Transparent);
for (int i = 0; i < 1000; i++) {
Geometry cl = g.clone(false);
cl.move(0, 0, -(i + 1));
rootNode.attachChild(cl);
}
flyCam.setMoveSpeed(20);
Logger.getLogger("com.jme3").setLevel(Level.WARNING);
this.setAppProfiler(new Profiler());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Attach a pair of parallel white lines in the z=1 plane.
*/
void createWhiteLines() {
Mesh lineMesh = new Mesh();
lineMesh.setMode(Mesh.Mode.Lines);
float[] corners = new float[]{
-1f, -1f, 0f,
-1f, 1f, 0f,
1f, 1f, 0f,
1f, -1f, 0f
};
lineMesh.setBuffer(VertexBuffer.Type.Position, 3, corners);
short[] indices = new short[]{0, 1, 2, 3};
lineMesh.setBuffer(VertexBuffer.Type.Index, 2, indices);
lineMesh.updateBound();
Geometry whiteLines = new Geometry("white lines", lineMesh);
Material white = assetManager.loadMaterial("Common/Materials/WhiteColor.j3m");
whiteLines.setMaterial(white);
whiteLines.move(0f, 0f, 1f);
rootNode.attachChild(whiteLines);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void simpleInitApp() {
flyCam.setMoveSpeed(10f);
cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f));
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(new ColorRGBA(1f, 1f, 1f, 1.0f));
rootNode.addLight(dl);
Spatial model = (Spatial) assetManager.loadModel("Models/Oto/OtoOldAnim.j3o");
model.center();
control = model.getControl(AnimControl.class);
control.addListener(this);
channel = control.createChannel();
for (String anim : control.getAnimationNames())
System.out.println(anim);
channel.setAnim("stand");
geom = (Geometry)((Node)model).getChild(0);
SkeletonControl skeletonControl = model.getControl(SkeletonControl.class);
Box b = new Box(.25f,3f,.25f);
Geometry item = new Geometry("Item", b);
item.move(0, 1.5f, 0);
item.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
Node n = skeletonControl.getAttachmentsNode("hand.right");
n.attachChild(item);
rootNode.attachChild(model);
inputManager.addListener(this, "Attack");
inputManager.addMapping("Attack", new KeyTrigger(KeyInput.KEY_SPACE));
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
quadGeom.move(1, 0, 0);
Material mat1 = assetManager.loadMaterial("Textures/BumpMapTest/SimpleBump.j3m");
teapot.move(-1, 0, 0);
teapot.setLocalScale(2f);
Material mat2 = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void simpleInitApp() {
// Create two boxes
Mesh mesh1 = new Box(0.5f, 0.5f, 0.5f);
geom1 = new Geometry("Box", mesh1);
geom1.move(2, 2, -.5f);
Material m1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
m1.setColor("Color", ColorRGBA.Blue);
geom1.setMaterial(m1);
rootNode.attachChild(geom1);
// load a character from jme3test-test-data
golem = assetManager.loadModel("Models/Oto/Oto.mesh.xml");
golem.scale(0.5f);
golem.setLocalTranslation(-1.0f, -1.5f, -0.6f);
// We must add a light to make the model visible
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
golem.addLight(sun);
rootNode.attachChild(golem);
// Create input
inputManager.addMapping("MoveRight", new KeyTrigger(KeyInput.KEY_L));
inputManager.addMapping("MoveLeft", new KeyTrigger(KeyInput.KEY_J));
inputManager.addMapping("MoveUp", new KeyTrigger(KeyInput.KEY_I));
inputManager.addMapping("MoveDown", new KeyTrigger(KeyInput.KEY_K));
inputManager.addListener(analogListener, new String[]{
"MoveRight", "MoveLeft", "MoveUp", "MoveDown"
});
}
private AnalogListener analogListener = new AnalogListener() {
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
g2.move(5, 0, 0);
g.getParent().attachChild(g2);
代码示例来源: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
float[] f = {-FastMath.PI / 2, 3 * FastMath.PI / 2, 0f};
groundBoxWhite.setLocalRotation(new Quaternion(f));
groundBoxWhite.move(7.5f, -.75f, 7.5f);
final Material groundMaterial = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
groundMaterial.setColor("Diffuse", new ColorRGBA(.9f, .9f, .9f, .9f));
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
geom.move(0, 0, FastMath.ZERO_TOLERANCE);
checkFilteredLights(0);
内容来源于网络,如有侵权,请联系作者删除!