本文整理了Java中com.jme3.scene.Spatial.scale()
方法的一些代码示例,展示了Spatial.scale()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spatial.scale()
方法的具体详情如下:
包路径:com.jme3.scene.Spatial
类名称:Spatial
方法名:scale
[英]Scales the spatial by the given value
[中]按给定值缩放空间
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Scales the spatial by the given value
*
* @return The spatial on which this method is called, e.g <code>this</code>.
*/
public Spatial scale(float s) {
return scale(s, s, s);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
s.scale(scale);
s.move(offset);
assets.add(s);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected Spatial makeCharacter() {
// load a character from jme3test-test-data
Spatial 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));
golem.addLight(sun);
return golem;
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected Spatial makeCharacter() {
// load a character from jme3test-test-data
Spatial 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);
return golem;
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void initialize(){
super.initialize();
System.out.println("Initialize");
RootNodeState state = new RootNodeState();
viewPort.attachScene(state.getRootNode());
stateManager.attach(state);
Spatial model = assetManager.loadModel("Models/Teapot/Teapot.obj");
model.scale(3);
model.setMaterial(assetManager.loadMaterial("Interface/Logo/Logo.j3m"));
state.getRootNode().attachChild(model);
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
inputManager,
audioRenderer,
guiViewPort);
niftyDisplay.getNifty().fromXml("Interface/Nifty/HelloJme.xml", "start");
guiViewPort.addProcessor(niftyDisplay);
}
代码示例来源: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
@Override
public void simpleInitApp() {
// activate physics
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
// init a physical test scene
PhysicsTestHelper.createPhysicsTestWorldSoccer(rootNode, assetManager, bulletAppState.getPhysicsSpace());
setupKeys();
// Add a physics character to the world
physicsCharacter = new CharacterControl(new CapsuleCollisionShape(0.5f, 1.8f), .1f);
physicsCharacter.setPhysicsLocation(new Vector3f(0, 1, 0));
characterNode = new Node("character node");
Spatial model = assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml");
model.scale(0.25f);
characterNode.addControl(physicsCharacter);
getPhysicsSpace().add(physicsCharacter);
rootNode.attachChild(characterNode);
characterNode.attachChild(model);
// set forward camera node that follows the character
camNode = new CameraNode("CamNode", cam);
camNode.setControlDir(ControlDirection.SpatialToCamera);
camNode.setLocalTranslation(new Vector3f(0, 1, -5));
camNode.lookAt(model.getLocalTranslation(), Vector3f.UNIT_Y);
characterNode.attachChild(camNode);
//disable the default 1st-person flyCam (don't forget this!!)
flyCam.setEnabled(false);
}
代码示例来源: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
ninja.scale(0.05f, 0.05f, 0.05f);
ninja.rotate(0.0f, -3.0f, 0.0f);
ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
elephant.scale(scale, scale, scale);
rootNode.attachChild(elephant);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
golem.scale(0.5f);
golem.setLocalTranslation(200.0f, -6f, 200f);
golem.setShadowMode(ShadowMode.CastAndReceive);
代码示例来源:origin: org.jmonkeyengine/jme3-core
/**
* Scales the spatial by the given value
*
* @return The spatial on which this method is called, e.g <code>this</code>.
*/
public Spatial scale(float s) {
return scale(s, s, s);
}
代码示例来源:origin: info.projectkyoto/mms-engine
/**
* Scales the spatial by the given value
*
* @return The spatial on which this method is called, e.g <code>this</code>.
*/
public Spatial scale(float s) {
return scale(s, s, s);
}
代码示例来源:origin: tonihele/OpenKeeper
public static void scale(final Spatial spatial) {
spatial.scale(MapLoader.TILE_WIDTH, MapLoader.TILE_HEIGHT, MapLoader.TILE_WIDTH);
}
代码示例来源:origin: us.ihmc/IHMCJMonkeyEngineToolkit
model.scale(0.01f);
rootNode.attachChild(model);
代码示例来源:origin: us.ihmc/ihmc-jmonkey-engine-toolkit
model.scale(0.01f);
rootNode.attachChild(model);
内容来源于网络,如有侵权,请联系作者删除!