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


Java ChaseCamera.setDefaultDistance方法代码示例

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


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

示例1: createSimpleChaseCamera

import com.jme3.input.ChaseCamera; //导入方法依赖的package包/类
public static ChaseCamera createSimpleChaseCamera(Camera camera
            , InputManager inputManager) {
        ChaseCamera chaseCam = new ChaseCamera(camera, inputManager);
        
        // 开启镜头跟随可能让部分人容易犯头晕
//        chaseCam.setSmoothMotion(true);
//        chaseCam.setTrailingEnabled(false);
        
        chaseCam.setInvertVerticalAxis(true);
        chaseCam.setLookAtOffset(Vector3f.UNIT_Y.mult(2f));
        chaseCam.setZoomSensitivity(0.5f);
        chaseCam.setRotationSpeed(5f);
        chaseCam.setRotationSensitivity(5);
        chaseCam.setMaxDistance(15);
        chaseCam.setMinDistance(2f);
        chaseCam.setDefaultDistance(15);
        chaseCam.setChasingSensitivity(5);
        chaseCam.setDownRotateOnCloseViewOnly(true); 
        chaseCam.setUpVector(Vector3f.UNIT_Y);
        // 不要隐藏光标,否则在MAC系统下鼠标点击后会上下错位
        chaseCam.setHideCursorOnRotate(false);
        return chaseCam;
    }
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:24,代码来源:SceneTools.java

示例2: initCam

import com.jme3.input.ChaseCamera; //导入方法依赖的package包/类
public void initCam() {
    app.getFlyByCamera().setEnabled(false);
    rootNode.attachChild(camObject);
    chaseCam = new ChaseCamera(app.getCamera(), camObject,
            app.getInputManager()) {
        @Override
        public void update(float tpf) {
            super.update(tpf);
            // custom update code
            if (labelState == null && stateManager != null) {
                labelState = stateManager.getState(LabelAppState.class);
            }
            if (labelState != null) {
                labelState.updateLabels();
            }
        }
    };

    chaseCam.setInvertVerticalAxis(true);
    chaseCam.setMinVerticalRotation(-90f);
    chaseCam.setDefaultDistance(20f);
    chaseCam.setMinDistance(2f);
    chaseCam.setMaxDistance(40f);
    chaseCam.setZoomSensitivity(1f);
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:26,代码来源:MVAppState.java

示例3: setUpCammera

import com.jme3.input.ChaseCamera; //导入方法依赖的package包/类
private void setUpCammera() {
    // Disable the default first-person cam!
    app.getFlyByCamera().setEnabled(false);
    cam.setRotation(new Quaternion(new float[]{0, (float) Math.PI / 2, 0}));
    // Enable a chase cam
    chaseCam = new ChaseCamera(cam, sa, inputManager);
    chaseCam.setDefaultDistance(70f);
    chaseCam.setMaxDistance(150f);
    chaseCam.setMinDistance(50f);
    chaseCam.setDefaultHorizontalRotation(-FastMath.PI / 2);
    chaseCam.setDefaultVerticalRotation(FastMath.PI / 4);
    chaseCam.setInvertVerticalAxis(true);
    chaseCam.setTrailingEnabled(false);
}
 
开发者ID:damhonglinh,项目名称:Fruity-Bang,代码行数:15,代码来源:Scene.java

示例4: simpleInitApp

import com.jme3.input.ChaseCamera; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    createScene();
    cam.setLocation(new Vector3f(8.4399185f, 11.189463f, 14.267577f));
    camNode = new CameraNode("Motion cam", cam);
    camNode.setControlDir(ControlDirection.SpatialToCamera);
    camNode.getControl(0).setEnabled(false);
    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);
    path.enableDebugShape(assetManager, rootNode);

    cameraMotionControl = new MotionTrack(camNode, path);
    cameraMotionControl.setLoopMode(LoopMode.Loop);
    //cameraMotionControl.setDuration(15f);
    cameraMotionControl.setLookAt(teapot.getWorldTranslation(), Vector3f.UNIT_Y);
    cameraMotionControl.setDirectionType(MotionTrack.Direction.LookAt);

    rootNode.attachChild(camNode);

    guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
    final BitmapText wayPointsText = new BitmapText(guiFont, false);
    wayPointsText.setSize(guiFont.getCharSet().getRenderedSize());

    guiNode.attachChild(wayPointsText);

    path.addListener(new MotionPathListener() {

        public void onWayPointReach(MotionTrack control, int wayPointIndex) {
            if (path.getNbWayPoints() == wayPointIndex + 1) {
                wayPointsText.setText(control.getSpatial().getName() + " Finish!!! ");
            } else {
                wayPointsText.setText(control.getSpatial().getName() + " Reached way point " + wayPointIndex);
            }
            wayPointsText.setLocalTranslation((cam.getWidth() - wayPointsText.getLineWidth()) / 2, cam.getHeight(), 0);
        }
    });

    flyCam.setEnabled(false);
    chaser = new ChaseCamera(cam, teapot);
    chaser.registerWithInput(inputManager);
    chaser.setSmoothMotion(true);
    chaser.setMaxDistance(50);
    chaser.setDefaultDistance(50);
    initInputs();

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

示例5: OSRBridge

import com.jme3.input.ChaseCamera; //导入方法依赖的package包/类
public OSRBridge(RenderManager rm, int width, int height, Node root) {
	this.rm = rm;
	this.root = root;

	cam = new Camera(width, height);

	vp = rm.createPreView("Offscreen View", cam);
	if (!ToolKit.isAndroid())
		vp.setClearFlags(true, true, true);
	else
		vp.setClearFlags(true, false, false);

	FrameBuffer offBuffer = new FrameBuffer(width, height, 1);

	tex = new Texture2D(width, height, Image.Format.RGBA8);
	tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	tex.setMagFilter(Texture.MagFilter.Bilinear);

	if (!ToolKit.isAndroid())
		offBuffer.setDepthBuffer(Image.Format.Depth);

	offBuffer.setColorTexture(tex);

	vp.setOutputFrameBuffer(offBuffer);

	setSpatial(root);
	vp.attachScene(root);

	chaseCam = new ChaseCamera(cam, root) {
		@Override
		public void setDragToRotate(boolean dragToRotate) {
			this.dragToRotate = dragToRotate;
			this.canRotate = !dragToRotate;
		}
	};
	chaseCam.setDefaultDistance(5f);
	chaseCam.setMaxDistance(340f);
	chaseCam.setDefaultHorizontalRotation(90 * FastMath.DEG_TO_RAD);
	chaseCam.setDefaultVerticalRotation(0f);
	cam.setFrustumFar(36000f);
	float aspect = (float) cam.getWidth() / (float) cam.getHeight();
	cam.setFrustumPerspective(45f, aspect, 0.1f, cam.getFrustumFar());
	chaseCam.setUpVector(Vector3f.UNIT_Y);
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:45,代码来源:OSRBridge.java

示例6: OSRBridge

import com.jme3.input.ChaseCamera; //导入方法依赖的package包/类
public OSRBridge(RenderManager rm, int width, int height, Node root) {
	this.rm = rm;
	this.root = root;

	cam = new Camera(width, height);
	
	vp = rm.createPreView("Offscreen View", cam);
	if (!Screen.isAndroid())	vp.setClearFlags(true, true, true);
	else						vp.setClearFlags(true, false, false);
	
	FrameBuffer offBuffer = new FrameBuffer(width, height, 1);
	
	tex = new Texture2D(width, height, Image.Format.RGBA8);
	tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	tex.setMagFilter(Texture.MagFilter.Bilinear);

	if (!Screen.isAndroid())
		offBuffer.setDepthBuffer(Image.Format.Depth);
	
	offBuffer.setColorTexture(tex);

	vp.setOutputFrameBuffer(offBuffer);
	
	setSpatial(root);
	vp.attachScene(root);
	
	chaseCam = new ChaseCamera(cam, root) {
		@Override
		 public void setDragToRotate(boolean dragToRotate) {
			this.dragToRotate = dragToRotate;
			this.canRotate = !dragToRotate;
		}
	};
	chaseCam.setDefaultDistance(5f);
	chaseCam.setMaxDistance(340f);
	chaseCam.setDefaultHorizontalRotation(90*FastMath.DEG_TO_RAD);
	chaseCam.setDefaultVerticalRotation(0f);
	cam.setFrustumFar(36000f);
	float aspect = (float)cam.getWidth() / (float)cam.getHeight();
	cam.setFrustumPerspective( 45f, aspect, 0.1f, cam.getFrustumFar() );
	chaseCam.setUpVector(Vector3f.UNIT_Y);
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:43,代码来源:OSRBridge.java

示例7: simpleInitApp

import com.jme3.input.ChaseCamera; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    createScene();
    cam.setLocation(new Vector3f(8.4399185f, 11.189463f, 14.267577f));
    camNode = new CameraNode("Motion cam", cam);
    camNode.setControlDir(ControlDirection.SpatialToCamera);
    camNode.getControl(CameraControl.class).setEnabled(false);
    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);
    path.enableDebugShape(assetManager, rootNode);

    cameraMotionControl = new MotionTrack(camNode, path);
    cameraMotionControl.setLoopMode(LoopMode.Loop);
    //cameraMotionControl.setDuration(15f);
    cameraMotionControl.setLookAt(teapot.getWorldTranslation(), Vector3f.UNIT_Y);
    cameraMotionControl.setDirectionType(MotionTrack.Direction.LookAt);

    rootNode.attachChild(camNode);

    guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
    final BitmapText wayPointsText = new BitmapText(guiFont, false);
    wayPointsText.setSize(guiFont.getCharSet().getRenderedSize());

    guiNode.attachChild(wayPointsText);

    path.addListener(new MotionPathListener() {

        public void onWayPointReach(MotionTrack control, int wayPointIndex) {
            if (path.getNbWayPoints() == wayPointIndex + 1) {
                wayPointsText.setText(control.getSpatial().getName() + " Finish!!! ");
            } else {
                wayPointsText.setText(control.getSpatial().getName() + " Reached way point " + wayPointIndex);
            }
            wayPointsText.setLocalTranslation((cam.getWidth() - wayPointsText.getLineWidth()) / 2, cam.getHeight(), 0);
        }
    });

    flyCam.setEnabled(false);
    chaser = new ChaseCamera(cam, teapot);
    chaser.registerWithInput(inputManager);
    chaser.setSmoothMotion(true);
    chaser.setMaxDistance(50);
    chaser.setDefaultDistance(50);
    initInputs();

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


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