当前位置: 首页>>代码示例>>Java>>正文


Java CameraNode.setLocalTranslation方法代码示例

本文整理汇总了Java中com.jme3.scene.CameraNode.setLocalTranslation方法的典型用法代码示例。如果您正苦于以下问题:Java CameraNode.setLocalTranslation方法的具体用法?Java CameraNode.setLocalTranslation怎么用?Java CameraNode.setLocalTranslation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.scene.CameraNode的用法示例。


在下文中一共展示了CameraNode.setLocalTranslation方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCameraMotion

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
private void createCameraMotion() {

        CameraNode camNode = cinematic.bindCamera("topView", cam);
        camNode.setLocalTranslation(new Vector3f(0, 50, 0));
        camNode.lookAt(model.getLocalTranslation(), Vector3f.UNIT_Y);

        CameraNode camNode2 = cinematic.bindCamera("aroundCam", cam);
        path = new MotionPath();
        path.setCycle(true);
        path.addWayPoint(new Vector3f(20, 3, 0));
        path.addWayPoint(new Vector3f(0, 3, 20));
        path.addWayPoint(new Vector3f(-20, 3, 0));
        path.addWayPoint(new Vector3f(0, 3, -20));
        path.setCurveTension(0.83f);
        cameraMotionTrack = new MotionTrack(camNode2, path);
        cameraMotionTrack.setLoopMode(LoopMode.Loop);
        cameraMotionTrack.setLookAt(model.getWorldTranslation(), Vector3f.UNIT_Y);
        cameraMotionTrack.setDirectionType(MotionTrack.Direction.LookAt);

    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:TestCinematic.java

示例2: makePlayer

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
Spatial makePlayer() {
	Node root = new Node("player");
	Geometry g = new Geometry("Player", new Sphere(16, 16, 0.5f));
	Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
	mat.setColor("Color", ColorRGBA.Red);
	g.setMaterial(mat);
	root.attachChild(g);

	CameraNode camn = new CameraNode("follower", app.getCamera());
	camn.setLocalTranslation(new Vector3f(0,2,6));
	camn.lookAt(root.getWorldTranslation(), Vector3f.UNIT_Y);
	root.attachChild(camn);

	root.addControl(c4t);
	return root;
}
 
开发者ID:davidB,项目名称:jme3_skel,代码行数:17,代码来源:PageInGame.java

示例3: setFirstPersonCam

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
/**Sets the chase cam to the minimum distance and heightens
 * the sensitivity of the cam. Called by input listener.
 */
public void setFirstPersonCam(){
	if (!getWorld().getScreenManager().getHudScreenController().chatFocused()){
		isInFirstPerson = !isInFirstPerson;
		if(isInFirstPerson){
			chaseCam.setEnabled(false);
			camNode = new CameraNode("cam",camera);
			((Node)getMesh()).attachChild(camNode);
			camNode.setLocalTranslation(new Vector3f(0,4,0));
			camNode.setLocalRotation(new Quaternion(0,1,0,0));
		}
		else{
			((Node)getMesh()).detachChild(camNode);
			chaseCam.setEnabled(true);
			chaseCam.setTrailingEnabled(true);
		}
		world.getScreenManager().getHudScreenController().hideShowCrossHairs(isInFirstPerson);
	}
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:22,代码来源:Player.java

示例4: loadCameraSettings

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
protected void loadCameraSettings() {        
    Vector3f centerPoint = new Vector3f((Game.MAP_SIZE * Game.TILE_SIZE) * 0.5f, 0, (Game.MAP_SIZE * Game.TILE_SIZE) * 0.5f);

    cameraJointNode = new Node("camerajoint");
    cameraJointNode.setLocalTranslation(centerPoint);
    rootNode.attachChild(cameraJointNode);

    cameraNode = new CameraNode("camnode", camera);
    cameraNode.setLocalTranslation(0, cameraHeight, cameraHeight * anglePerZ);
    cameraNode.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
    cameraJointNode.attachChild(cameraNode);
}
 
开发者ID:jMonkeyEngine,项目名称:examplegame-skulls,代码行数:13,代码来源:EditScreen.java

示例5: loadCameraSettings

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
/**
 * Load how the camera will view
 */
protected void loadCameraSettings() {
    float angleY = FastMath.DEG_TO_RAD * 0f;
    Vector3f centerPoint = new Vector3f((Game.MAP_SIZE * Game.TILE_SIZE) * 0.5f, 0, (Game.MAP_SIZE * Game.TILE_SIZE) * 0.5f);

    cameraJointNode = new Node("camerajoint");
    cameraJointNode.setLocalTranslation(centerPoint);
    cameraJointNode.rotate(0, angleY, 0);
    rootNode.attachChild(cameraJointNode);

    cameraNode = new CameraNode("camnode", camera);
    cameraNode.setLocalTranslation(0, cameraHeight, cameraHeight * anglePerZ);
    cameraNode.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
    cameraJointNode.attachChild(cameraNode);
}
 
开发者ID:jMonkeyEngine,项目名称:examplegame-skulls,代码行数:18,代码来源:PlayScreen.java

示例6: simpleInitApp

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    flyCam.setMoveSpeed(20);
    rootNode.attachChild(helperNode);

    initializeFloor();

    initializeBloom();

    initializePlayer();

    initializeEnemy();

    // Disable the default flyby cam
    flyCam.setEnabled(false);
    //create the camera Node
    CameraNode camNode = new CameraNode("Camera Node", cam);
    //This mode means that camera copies the movements of the target:
    camNode.setControlDir(ControlDirection.SpatialToCamera);
    //Attach the camNode to the target:
    player.attachChild(camNode);
    //Move camNode, e.g. behind and above the target:
    camNode.setLocalTranslation(new Vector3f(0, 6, -18));
    //Rotate the camNode to look at the target:
    camNode.lookAt(player.getLocalTranslation(), Vector3f.UNIT_Y);
    camNode.setLocalTranslation(new Vector3f(0, 12, -22));

    registerInput();

    if (addDebugObjects) {
        Geometry playfield = new Geometry("debuggrid", new Grid(floorsize, floorsize, floorsize / 10));
        Material plafieldmat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        plafieldmat.getAdditionalRenderState().setWireframe(true);
        plafieldmat.setColor("Color", ColorRGBA.Yellow);
        playfield.setMaterial(plafieldmat);
        playfield.center().move(0, 0.2f, 0);
        rootNode.attachChild(playfield);
    }
}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:41,代码来源:Main.java

示例7: simpleInitApp

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
@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);

}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:33,代码来源:TestPhysicsCharacter.java

示例8: simpleInitApp

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
public void simpleInitApp() {
  // load a teapot model 
  teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
  teaGeom.setMaterial(mat);
  //create a node to attach the geometry and the camera node
  teaNode = new Node("teaNode");
  teaNode.attachChild(teaGeom);
  rootNode.attachChild(teaNode);
  // create a floor
  mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
  Geometry ground = new Geometry("ground", new Quad(50, 50));
  ground.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X));
  ground.setLocalTranslation(-25, -1, 25);
  ground.setMaterial(mat);
  rootNode.attachChild(ground);

  //creating the camera Node
  camNode = new CameraNode("CamNode", cam);
  //Setting the direction to Spatial to camera, this means the camera will copy the movements of the Node
  camNode.setControlDir(ControlDirection.SpatialToCamera);
  //attaching the camNode to the teaNode
  teaNode.attachChild(camNode);
  //setting the local translation of the cam node to move it away from the teanNode a bit
  camNode.setLocalTranslation(new Vector3f(-10, 0, 0));
  //setting the camNode to look at the teaNode
  camNode.lookAt(teaNode.getLocalTranslation(), Vector3f.UNIT_Y);

  //disable the default 1st-person flyCam (don't forget this!!)
  flyCam.setEnabled(false);

  registerInput();
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:35,代码来源:TestCameraNode.java

示例9: setWorld

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
public void setWorld(World w, boolean physics, boolean rendering, WorldType worldType) {
	if(world != null) {
		for(Entity e : world.getEntitiesOfClass(Entity.class))
			world.removeEntity(e);
		world.detachFromGame(stateManager);
		rootNode.detachChild(world.getNode());
	}

	world = w;

	if(world != null) {
		world.USE_SUPERFAST_PHYSICS = !physics;
		World.USE_SUPERFAST_RENDERING = !rendering;

		world.attachToGame(stateManager, new CachingAssetManager(assetManager), null, cam, worldType, viewPort);

		if(!physics)
			stateManager.detach(stateManager.getState(BulletAppState.class));
		if(rendering) {
			rootNode.attachChild(world.getNode());

			if(worldType == WorldType.SP) {
				CameraNode cn = new CameraNode("camera", cam);
		        cn.setLocalRotation(new Quaternion(new float[] {(float)Math.PI*0.25f, (float)Math.PI, 0}));
		        cn.setLocalTranslation(0, 80, 80);
		        ((Node)world.getPlayer().getMesh()).attachChild(cn);
			}
		}
	}
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:31,代码来源:GameTest.java

示例10: setupCinematic

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
public void setupCinematic(final Node jaime) {
    cinematic = new Cinematic(rootNode, 60);
    stateManager.attach(cinematic);

    jaime.move(0, 0, -3);
    AnimationFactory af = new AnimationFactory(0.7f, "JumpForward");
    af.addTimeTranslation(0, new Vector3f(0, 0, -3));
    af.addTimeTranslation(0.35f, new Vector3f(0, 1, -1.5f));
    af.addTimeTranslation(0.7f, new Vector3f(0, 0, 0));
    jaime.getControl(AnimControl.class).addAnim(af.buildAnimation());

    cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "Idle",3, LoopMode.DontLoop));
    float jumpStart = cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "JumpStart", LoopMode.DontLoop));
    cinematic.addCinematicEvent(jumpStart+0.2f, new AnimationEvent(jaime, "JumpForward", LoopMode.DontLoop,1));
    cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "JumpEnd", LoopMode.DontLoop));
    cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Punches", LoopMode.DontLoop));
    cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "SideKick", LoopMode.DontLoop));
    float camStart = cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Taunt", LoopMode.DontLoop));
    cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Idle",1, LoopMode.DontLoop));
    cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Wave", LoopMode.DontLoop));
    cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Idle", LoopMode.DontLoop));

    CameraNode camNode = cinematic.bindCamera("cam", cam);
    camNode.setLocalTranslation(new Vector3f(1.1f, 1.2f, 2.9f));
    camNode.lookAt(new Vector3f(0, 0.5f, 0), Vector3f.UNIT_Y);

    MotionPath path = new MotionPath();
    path.addWayPoint(new Vector3f(1.1f, 1.2f, 2.9f));
    path.addWayPoint(new Vector3f(0f, 1.2f, 3.0f));
    path.addWayPoint(new Vector3f(-1.1f, 1.2f, 2.9f));
    path.enableDebugShape(assetManager, rootNode);
    path.setCurveTension(0.8f);

    MotionEvent camMotion = new MotionEvent(camNode, path,6);
    camMotion.setDirectionType(MotionEvent.Direction.LookAt);
    camMotion.setLookAt(new Vector3f(0, 0.5f, 0), Vector3f.UNIT_Y);
    cinematic.addCinematicEvent(camStart, camMotion);
    cinematic.activateCamera(0, "cam");


    cinematic.fitDuration();
    cinematic.setSpeed(1.2f);
    cinematic.setLoopMode(LoopMode.Loop);
    cinematic.play();
}
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:46,代码来源:TestJaimeJ3o.java

示例11: setupCinematic

import com.jme3.scene.CameraNode; //导入方法依赖的package包/类
public void setupCinematic(final Node jaime) {
	cinematic = new Cinematic(rootNode, 60);
	stateManager.attach(cinematic);

	jaime.move(0, 0, -3);
	AnimationFactory af = new AnimationFactory(0.7f, "JumpForward");
	af.addTimeTranslation(0, new Vector3f(0, 0, -3));
	af.addTimeTranslation(0.35f, new Vector3f(0, 1, -1.5f));
	af.addTimeTranslation(0.7f, new Vector3f(0, 0, 0));
	jaime.getControl(AnimControl.class).addAnim(af.buildAnimation());

	cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "Idle",3, LoopMode.DontLoop));
	float jumpStart = cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "JumpStart", LoopMode.DontLoop));
	cinematic.addCinematicEvent(jumpStart+0.2f, new AnimationEvent(jaime, "JumpForward", LoopMode.DontLoop,1));
	cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "JumpEnd", LoopMode.DontLoop));
	cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Punches", LoopMode.DontLoop));
	cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "SideKick", LoopMode.DontLoop));
	float camStart = cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Taunt", LoopMode.DontLoop));
	cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Idle",1, LoopMode.DontLoop));
	cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Wave", LoopMode.DontLoop));
	cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Idle", LoopMode.DontLoop));

	CameraNode camNode = cinematic.bindCamera("cam", cam);
	camNode.setLocalTranslation(new Vector3f(1.1f, 1.2f, 2.9f));
	camNode.lookAt(new Vector3f(0, 0.5f, 0), Vector3f.UNIT_Y);

	MotionPath path = new MotionPath();
	path.addWayPoint(new Vector3f(1.1f, 1.2f, 2.9f));
	path.addWayPoint(new Vector3f(0f, 1.2f, 3.0f));
	path.addWayPoint(new Vector3f(-1.1f, 1.2f, 2.9f));
	path.enableDebugShape(assetManager, rootNode);
	path.setCurveTension(0.8f);

	MotionEvent camMotion = new MotionEvent(camNode, path,6);
	camMotion.setDirectionType(MotionEvent.Direction.LookAt);
	camMotion.setLookAt(new Vector3f(0, 0.5f, 0), Vector3f.UNIT_Y);
	cinematic.addCinematicEvent(camStart, camMotion);
	cinematic.activateCamera(0, "cam");


	cinematic.fitDuration();
	cinematic.setSpeed(1.2f);
	cinematic.setLoopMode(LoopMode.Loop);
	cinematic.play();
}
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:46,代码来源:TestXbufWithMaterialHook.java


注:本文中的com.jme3.scene.CameraNode.setLocalTranslation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。