本文整理汇总了Java中com.jme3.scene.control.CameraControl类的典型用法代码示例。如果您正苦于以下问题:Java CameraControl类的具体用法?Java CameraControl怎么用?Java CameraControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CameraControl类属于com.jme3.scene.control包,在下文中一共展示了CameraControl类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doChase
import com.jme3.scene.control.CameraControl; //导入依赖的package包/类
private void doChase(Vector3f position, float distance) {
Camera camera = editorCam.getCamera();
Vector3f camEndLoc = new Vector3f().set(position).subtractLocal(camera.getDirection().mult(distance));
CameraNode cameraNode = new CameraNode("", editorCam.getCamera());
cameraNode.setLocalRotation(editorCam.getCamera().getRotation());
cameraNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
CurveMoveAnim locAnim = new CurveMoveAnim();
locAnim.setControlPoints(Arrays.asList(camera.getLocation(), camEndLoc));
locAnim.setCurveTension(0);
locAnim.setTarget(cameraNode);
locAnim.setUseTime(0.5f);
locAnim.addListener((Anim anim) -> {
editorCam.setFocus(position);
});
locAnim.start();
AnimNode locAnimNode = new AnimNode(locAnim, true);
locAnimNode.attachChild(cameraNode);
edit.getEditRoot().attachChild(locAnimNode);
}
开发者ID:huliqing,项目名称:LuoYing,代码行数:23,代码来源:CameraTool.java
示例2: createTPCamera
import com.jme3.scene.control.CameraControl; //导入依赖的package包/类
private void createTPCamera(){
tpc = new ThirdPersonCameraControl(this.getNode());
CameraControl camControl = new CameraControl(app.getCamera());
Node camNode = new Node("camNode");
Node pitchNode = new Node("pitchNode");
Node yawNode = new Node("yawNode");
this.getNode().attachChild(yawNode);
yawNode.attachChild(pitchNode);
pitchNode.attachChild(camNode);
this.getHeadNode().attachChild(camNode);
camNode.addControl(camControl);
camNode.addControl(tpc);
camNode.setLocalTranslation(0,5f,-20f);
app.getGameplayManager().addPlayerListener(pc, tpc);
}
开发者ID:Daepso,项目名称:minerim,代码行数:16,代码来源:MainPlayer.java
示例3: bindCamera
import com.jme3.scene.control.CameraControl; //导入依赖的package包/类
public CameraNode bindCamera(String cameraName, Camera cam) {
CameraNode node = new CameraNode(cameraName, cam);
node.setControlDir(ControlDirection.SpatialToCamera);
node.getControl(CameraControl.class).setEnabled(false);
cameras.put(cameraName, node);
scene.attachChild(node);
return node;
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:9,代码来源:Cinematic.java
示例4: postInitialize
import com.jme3.scene.control.CameraControl; //导入依赖的package包/类
@Override
protected final void postInitialize() {
flyCamera = app.getFlyByCamera().isEnabled();
mouseManager = parent.getMouseManager();
stateManager.attach(gameKeysState = new GameKeysAppState());
// Player
playerEntity = parent.getPlayerEntity();
// Camera
Quaternion rot = new Quaternion();
rot.fromAngleAxis(0, Vector3f.UNIT_X);
rot.fromAngleAxis(0, Vector3f.UNIT_Y);
rot.fromAngleAxis(0, Vector3f.UNIT_Z);
this.app.getCamera().setRotation(rot);
camNode = new CameraNode("CamNode", this.app.getCamera());
camNode.setControlDir(CameraControl.ControlDirection.CameraToSpatial);
camNode.setEnabled(true);
camNode.lookAt(playerEntity.getSpatial().getLocalTranslation(), Vector3f.UNIT_Y);
chaseCam = new DetachableChaseCam(camNode.getCamera(), playerEntity.getSpatial(), inputManager) {
@Override
protected void followView(float rotation) {
}
};
chaseCam.setPushZoom(true);
chaseCam.setHeightAdjust(-5f);
chaseCam.setLookAtOffset(new Vector3f(0, 20, 0));
chaseCam.setSmoothMotion(false);
chaseCam.setDownRotateOnCloseViewOnly(true);
chaseCam.setInvertVerticalAxis(true);
chaseCam.setChasingSensitivity(5f);
chaseCam.setDragToRotate(true);
chaseCam.setTrailingEnabled(true);
chaseCam.setDefaultDistance(56);
chaseCam.setMaxDistance(200);
chaseCam.setRotationSpeed(Constants.CAMERA_ROTATE_SPEED);
chaseCam.setZoomSensitivity(Constants.CAMERA_ZOOM_SENSITIVITY);
chaseCam.setDefaultHorizontalRotation(-FastMath.DEG_TO_RAD * 90);
chaseCam.setDefaultVerticalRotation(FastMath.DEG_TO_RAD * 10);
app.getFlyByCamera().setEnabled(false);
// NOTE - This is important, the camera needs to be added once the
// player spatial is actually fully
// loaded or we'll get this weird flickering in physics. This took AGES
// to find
if (playerEntity.isLoadedScene()) {
playerEntity.getSpatial().addControl(chaseCam);
} else {
playerEntity.invoke(AbstractLoadableEntity.When.AFTER_SCENE_LOADED, new Callable<Void>() {
public Void call() throws Exception {
playerEntity.getSpatial().addControl(chaseCam);
return null;
}
});
}
}
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:63,代码来源:GamePlayAppState.java
示例5: CameraNode
import com.jme3.scene.control.CameraControl; //导入依赖的package包/类
public CameraNode(String name, Camera camera) {
this(name, new CameraControl(camera));
}
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:CameraNode.java
示例6: simpleInitApp
import com.jme3.scene.control.CameraControl; //导入依赖的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
示例7: initInputs
import com.jme3.scene.control.CameraControl; //导入依赖的package包/类
private void initInputs() {
inputManager.addMapping("display_hidePath", new KeyTrigger(KeyInput.KEY_P));
inputManager.addMapping("SwitchPathInterpolation", new KeyTrigger(KeyInput.KEY_I));
inputManager.addMapping("tensionUp", new KeyTrigger(KeyInput.KEY_U));
inputManager.addMapping("tensionDown", new KeyTrigger(KeyInput.KEY_J));
inputManager.addMapping("play_stop", new KeyTrigger(KeyInput.KEY_SPACE));
ActionListener acl = new ActionListener() {
public void onAction(String name, boolean keyPressed, float tpf) {
if (name.equals("display_hidePath") && keyPressed) {
if (active) {
active = false;
path.disableDebugShape();
} else {
active = true;
path.enableDebugShape(assetManager, rootNode);
}
}
if (name.equals("play_stop") && keyPressed) {
if (playing) {
playing = false;
cameraMotionControl.stop();
chaser.setEnabled(true);
camNode.getControl(CameraControl.class).setEnabled(false);
} else {
playing = true;
chaser.setEnabled(false);
camNode.getControl(CameraControl.class).setEnabled(true);
cameraMotionControl.play();
}
}
if (name.equals("SwitchPathInterpolation") && keyPressed) {
if (path.getPathSplineType() == SplineType.CatmullRom){
path.setPathSplineType(SplineType.Linear);
} else {
path.setPathSplineType(SplineType.CatmullRom);
}
}
if (name.equals("tensionUp") && keyPressed) {
path.setCurveTension(path.getCurveTension() + 0.1f);
System.err.println("Tension : " + path.getCurveTension());
}
if (name.equals("tensionDown") && keyPressed) {
path.setCurveTension(path.getCurveTension() - 0.1f);
System.err.println("Tension : " + path.getCurveTension());
}
}
};
inputManager.addListener(acl, "display_hidePath", "play_stop", "SwitchPathInterpolation", "tensionUp", "tensionDown");
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:57,代码来源:TestCameraMotionPath.java
示例8: enableCurrentCam
import com.jme3.scene.control.CameraControl; //导入依赖的package包/类
private void enableCurrentCam(boolean enabled) {
if (currentCam != null) {
currentCam.getControl(CameraControl.class).setEnabled(enabled);
}
}
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:6,代码来源:Cinematic.java
注:本文中的com.jme3.scene.control.CameraControl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论