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


Java ChaseCamera类代码示例

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


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

示例1: buildPlayer

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
private void buildPlayer() {
    spaceCraft = assetManager.loadModel("Models/HoverTank/Tank2.mesh.xml");
    CollisionShape colShape = CollisionShapeFactory.createDynamicMeshShape(spaceCraft);
    spaceCraft.setShadowMode(ShadowMode.CastAndReceive);
    spaceCraft.setLocalTranslation(new Vector3f(-140, 14, -23));
    spaceCraft.setLocalRotation(new Quaternion(new float[]{0, 0.01f, 0}));

    hoverControl = new PhysicsHoverControl(colShape, 500);
    hoverControl.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_02);

    spaceCraft.addControl(hoverControl);


    rootNode.attachChild(spaceCraft);
    getPhysicsSpace().add(hoverControl);

    ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
    spaceCraft.addControl(chaseCam);

    flyCam.setEnabled(false);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:TestHoveringTank.java

示例2: 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

示例3: 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

示例4: setCam

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
void setCam() {
        chaseCam = new ChaseCamera(cam, ship, inputManager);
        chaseCam.setDragToRotate(true);
        chaseCam.setTrailingEnabled(false);

        chaseCam.setInvertVerticalAxis(true);

        chaseCam.setMinVerticalRotation(-FastMath.PI * 0.45f);
        chaseCam.setMaxVerticalRotation(FastMath.PI * 0.45f);

        chaseCam.setMinDistance(10f);
        chaseCam.setMaxDistance(20f);

        chaseCam.setRotationSpeed(0.3f);
//        chaseCam.setDownRotateOnCloseViewOnly(false);   
//        chaseCam.setHideCursorOnRotate(false);

        chaseCam.setToggleRotationTrigger(new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));
        chaseCam.setEnabled(true);
    }
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:21,代码来源:SpaceShip.java

示例5: EmitterModule

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
public EmitterModule(final SimpleApplication app) {
        super(app.getAssetManager().loadTexture("org/hexgridapi/assets/Textures/"
                + "Icons/Buttons/hexIconBW.png").getImage(),
                "Emitter Module", null, false);
        this.app = app;
        //@todo need to be cleanned
//        app.getAssetManager().registerLocator("/home/roah/Documents/jmonkey/3.1/tonegodProjects/EmitterBuilder/assets", FileLocator.class);
        screen = new Screen(app, "tonegod/gui/style/atlasdef/style_map.gui.xml");
        screen.setUseTextureAtlas(true, "tonegod/gui/style/atlasdef/atlas.png");
//        screen.setUseCustomCursors(true);
        
        builder = new EmitterBuilder(app, screen);
        chaseCam = new ChaseCamera(app.getCamera(), builder.getRootNode(), app.getInputManager());
        app.enqueue(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                if(app.getGuiNode().getControl(Screen.class) == null)
                    app.getGuiNode().addControl(screen);
                return null;
            }
        });
    }
 
开发者ID:MultiverseKing,项目名称:MultiverseKing_JME,代码行数:23,代码来源:EmitterModule.java

示例6: simpleInitApp

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
@Override
public void simpleInitApp() {
    final Node buggy = (Node) assetManager.loadModel("Models/Buggy/Buggy.j3o");

    TextureKey key = new TextureKey("Textures/Sky/Bright/BrightSky.dds", true);
    key.setGenerateMips(true);
    key.setAsCube(true);
    final Texture tex = assetManager.loadTexture(key);

    for (Spatial geom : buggy.getChildren()) {
        if (geom instanceof Geometry) {
            Material m = ((Geometry) geom).getMaterial();
            m.setTexture("EnvMap", tex);
            m.setVector3("FresnelParams", new Vector3f(0.05f, 0.18f, 0.11f));
        }
    }

    flyCam.setEnabled(false);

    ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
    chaseCam.setLookAtOffset(new Vector3f(0,0.5f,-1.0f));
    buggy.addControl(chaseCam);
    rootNode.attachChild(buggy);
    rootNode.attachChild(SkyFactory.createSky(assetManager, tex, false));

    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    BloomFilter bf = new BloomFilter(BloomFilter.GlowMode.Objects);
    bf.setBloomIntensity(2.3f);
    bf.setExposurePower(0.6f);
    
    fpp.addFilter(bf);
    
    viewPort.addProcessor(fpp);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:35,代码来源:TestEnvironmentMapping.java

示例7: simpleInitApp

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
@Override
public void simpleInitApp() {
    Node tank = (Node) assetManager.loadModel("Models/HoverTank/Tank2.mesh.xml");

    flyCam.setEnabled(false);
    ChaseCamera chaseCam = new ChaseCamera(cam, tank, inputManager);
    chaseCam.setSmoothMotion(true);
    chaseCam.setMaxDistance(100000);
    chaseCam.setMinVerticalRotation(-FastMath.PI / 2);
    viewPort.setBackgroundColor(ColorRGBA.DarkGray);

    Geometry tankGeom = (Geometry) tank.getChild(0);
    LodControl control = new LodControl();
    tankGeom.addControl(control);
    rootNode.attachChild(tank);

    Vector3f lightDir = new Vector3f(-0.8719428f, -0.46824604f, 0.14304268f);
    DirectionalLight dl = new DirectionalLight();
    dl.setColor(new ColorRGBA(1.0f, 0.92f, 0.75f, 1f));
    dl.setDirection(lightDir);

    Vector3f lightDir2 = new Vector3f(0.70518064f, 0.5902297f, -0.39287305f);
    DirectionalLight dl2 = new DirectionalLight();
    dl2.setColor(new ColorRGBA(0.7f, 0.85f, 1.0f, 1f));
    dl2.setDirection(lightDir2);

    rootNode.addLight(dl);
    rootNode.addLight(dl2);
    rootNode.attachChild(tank);

    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    BloomFilter bf = new BloomFilter(BloomFilter.GlowMode.Objects);
    bf.setBloomIntensity(2.0f);
    bf.setExposurePower(1.3f);
    fpp.addFilter(bf);
    BloomUI bui = new BloomUI(inputManager, bf);
    viewPort.addProcessor(fpp);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:39,代码来源:TestHoverTank.java

示例8: simpleInitApp

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
@Override
    public void simpleInitApp() {
        Box b = new Box(Vector3f.ZERO, 0.5f, 0.5f, 0.5f);
        geom = new Geometry("Box", b);
        geom.updateModelBound();

        Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
        geom.setMaterial(mat);
//        geom.setLocalTranslation(0,2,1);
        rootNode.attachChild(geom);
        
        DirectionalLight dl = new DirectionalLight();
        dl.setDirection(new Vector3f(-0.8f, -0.6f, -0.08f).normalizeLocal());
        dl.setColor(new ColorRGBA(1,1,1,1));
        rootNode.addLight(dl);        
      
        Geometry geom2 = geom.clone();
        geom2.setLocalScale(new Vector3f(10f, 0.1f, 10f));
        geom2.move(0, -0.5f, 0);
        rootNode.attachChild(geom2);
        
//        flyCam.setMoveSpeed(30);
        flyCam.setEnabled(false);
        viewPort.setBackgroundColor(ColorRGBA.Gray);   
        
        SimpleCameraState simpleCamState = new SimpleCameraState(this);
        stateManager.attach(simpleCamState);
        SimpleChaseCamera chaseCam = simpleCamState.getChaseCamera();
        chaseCam.setRotateSpeed(3.0f);
        chaseCam.setTransformOffset(new Vector3f(0, 0.5f, 0));
        chaseCam.setSpatialToFollow(geom);
        chaseCam.updatePosition();
        chaseCam.constraintCamera();
        
        ChaseCamera chk; // just for my tests
    }
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:37,代码来源:SimpleChaseCameraTest.java

示例9: PlayerMappings

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
public PlayerMappings (SimpleApplication asm, Node ship, 
        PlayerControl playerControl, ChaseCamera chase) {
    
    
    this.asm = asm;
    this.ship = ship;
    this.chase = chase;
    this.playerControl = playerControl;
    weaponControl = this.ship.getControl(ShipWeaponControl.class);
    setupKeys(this.asm.getInputManager());
    
}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:13,代码来源:PlayerMappings.java

示例10: addLocalPlayer

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
private Node addLocalPlayer(String playerName) {
    // create player (model, action control, properties, etc)
    // and attach it to *** actual scene ***
    if(players == null) {
        players = new ArrayList<>();
    }
    Node player = createPlayer(playerName, new Integer(players.size()), true);
    player.addControl(new HealthBarControl(this.app, player));
    // start player basic key controls
    /*
    if (actualScene.getName().equals(this.app.getMagicallyousSceneName())) {
        PlayerActionInput playerActionInput =
                stateManager.getState(PlayerActionInput.class);
        if (playerActionInput != null) {
            //playerActionInput.cleanupKeys(this.app.getInputManager());
            stateManager.detach(playerActionInput);
            playerActionInput.cleanup();
        }
        stateManager.attach(new PlayerActionInput());
    }
    */
    stateManager.attach(new PlayerSendNetInput());
    //stateManager.attach(new PlayerActionInput());
 
    // start camera
    this.app.getFlyByCamera().setEnabled(false);
    chaseCamera = new ChaseCamera(this.app.getCamera(), player, this.app.getInputManager());
    chaseCamera.setUpVector(Vector3f.UNIT_Y);
    chaseCamera.setSmoothMotion(true);
    ToneGodGuiState toneGodGuiState = stateManager.getState(ToneGodGuiState.class);
    if (toneGodGuiState != null) {
        stateManager.detach(toneGodGuiState);
        //this.app.getGuiNode().removeControl(Screen.class);
        this.app.getGuiNode().detachAllChildren();
    }
    stateManager.attach(new ToneGodGuiState());
    return player;
}
 
开发者ID:duodecimo,项目名称:magicallyous,代码行数:39,代码来源:PlayerAppState.java

示例11: 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

示例12: getChaseCam

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
public ChaseCamera getChaseCam() {
	return chaseCam;
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:4,代码来源:GamePlayAppState.java

示例13: update

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
@Override
public void update(float tpf) {
	// I have been known to set Vector2f.ZERO to other values (grr.. wish
	// this was immutable sometimes)
	if (Vector2f.ZERO.x != 0 || Vector2f.ZERO.y != 0) {
		System.err.println("You fool! You have modified Vector2f.ZERO to " + Vector2f.ZERO);
		System.exit(1);
	}
	final AbstractSpawnEntity playerNode = parent.getParent().getPlayerEntity();
	if (playerNode != null) {
		Vector3f s = playerNode.getSpatial().getLocalTranslation();
		wx.setText(String.format("%6.1f", s.x));
		wy.setText(String.format("%6.1f", s.y));
		wz.setText(String.format("%6.1f", s.z));
		wr.setText(String.format("%d", parent.getParent().getSpawn().getRotation()));
		PageLocation ploc = parent.getParent().getViewTile();
		tx.setText(String.format("%d", ploc.x));
		ty.setText(String.format("%d", ploc.y));
		Vector3f cs = app.getCamera().getLocation();
		cx.setText(String.format("%6.1f", cs.x));
		cy.setText(String.format("%6.1f", cs.y));
		cz.setText(String.format("%6.1f", cs.z));
		final GamePlayAppState state = stateManager.getState(GamePlayAppState.class);
		if (state != null) {
			ChaseCamera chaseCam = state.getChaseCam();
			if (chaseCam != null) {
				chd.setText(String.format("%6.1f", chaseCam.getDistanceToTarget()));
				chh.setText(String.format("%6.1f",
						FastMath.normalize(chaseCam.getHorizontalRotation(), 0, FastMath.TWO_PI) * FastMath.RAD_TO_DEG));
				chv.setText(String.format("%6.1f", chaseCam.getVerticalRotation() * FastMath.RAD_TO_DEG));
			}

		}
		if (parent.getParent().getTerrainLoader().hasTerrain()) {
			final Point3D location = parent.getParent().getSpawn().getLocation();
			if (location != null) {
				Vector3f ta = parent.getParent().getTerrainLoader().getSlopeAtWorldPosition(IceUI.toVector2fXZ(location));
				if (ta != null) {
					float angx = Vector3f.UNIT_X.angleBetween(ta);
					float angy = Vector3f.UNIT_Y.angleBetween(ta);
					float angz = Vector3f.UNIT_Z.angleBetween(ta);
					tax.setText(String.format("%3.3f", ta.x));
					tay.setText(String.format("%3.3f", (1f - ta.y) * FastMath.RAD_TO_DEG));
					taz.setText(String.format("%3.3f", ta.z));
					tangx.setText(String.format("%3.3f", angx * FastMath.RAD_TO_DEG));
					tangy.setText(String.format("%3.3f", angy * FastMath.RAD_TO_DEG));
					tangz.setText(String.format("%3.3f", angz * FastMath.RAD_TO_DEG));
				}
			}
		}
	}
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:53,代码来源:DebugInfoAppState.java

示例14: getChaseCamera

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
public ChaseCamera getChaseCamera() {
	return chaseCamera;
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:4,代码来源:MoveableCharacterControl.java

示例15: trackCamera

import com.jme3.input.ChaseCamera; //导入依赖的package包/类
public void trackCamera(ChaseCamera chaseCamera, float tpf) {
	this.chaseCamera = chaseCamera;
	move(Type.TRACK_CAMERA, chaseCamera != null, tpf);
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:5,代码来源:MoveableCharacterControl.java


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