本文整理汇总了Java中com.jme3.input.ChaseCamera.setMaxDistance方法的典型用法代码示例。如果您正苦于以下问题:Java ChaseCamera.setMaxDistance方法的具体用法?Java ChaseCamera.setMaxDistance怎么用?Java ChaseCamera.setMaxDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.input.ChaseCamera
的用法示例。
在下文中一共展示了ChaseCamera.setMaxDistance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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();
}
示例7: 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);
}
示例8: simpleInitApp
import com.jme3.input.ChaseCamera; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
stateManager.attach(new ScreenshotAppState());
// viewPort.setBackgroundColor(ColorRGBA.White);
flyCam.setEnabled(false);
chaseCam = new ChaseCamera(cam, rootNode, inputManager);
rootNode.rotate(-FastMath.HALF_PI, 0, 0);
chaseCam.setMinVerticalRotation(-FastMath.HALF_PI+0.01f);
chaseCam.setMaxDistance(200);
DirectionalLight light = new DirectionalLight();
light.setDirection((new Vector3f(-0.1f, -0.1f, -0.1f)).normalize());
rootNode.addLight(light);
AmbientLight ambientLight = new AmbientLight(new ColorRGBA(0.6f, 0.6f, 0.6f, 1));
rootNode.addLight(ambientLight);
// DirectionalLightShadowFilter filter = new DirectionalLightShadowFilter(assetManager, 512, 4);
// filter.setLight(light);
// FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
// fpp.addFilter(filter);
// viewPort.addProcessor(fpp);
//load high-resolution model
assetManager.registerLocator("./treemesh/", FileLocator.class);
highResTree = assetManager.loadModel(TREE+"/Tree.j3o");
float size = highResTree.getWorldBound().getCenter().z * 2;
highResTree = null;
assetManager.clearCache();
System.out.println("size: "+size);
//load impositor
TreeInfo treeInfo = new TreeInfo();
treeInfo.name = TREE;
treeInfo.impostorCount = ImpositorCreator.IMPOSITOR_COUNT;
treeInfo.treeSize = size;
treeInfo.impostorFadeNear = 30;
treeInfo.impostorFadeFar = 50;
treeInfo.highResStemFadeNear = 30;
treeInfo.highResStemFadeFar = 50;
treeInfo.highResLeavesFadeNear = 30;
treeInfo.highResLeavesFadeFar = 55;
impostor = new TreeNode(treeInfo, assetManager, cam);
impostor.setUseHighRes(true);
impostor.move(0, 0, -size/2);
rootNode.attachChild(impostor);
inputManager.addMapping("recording", new KeyTrigger(KeyInput.KEY_F10));
inputManager.addListener(this, "recording");
//ground plane
Quad groundQuad = new Quad(40, 40);
Geometry ground = new Geometry("ground", groundQuad);
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat.setTexture("DiffuseMap", assetManager.loadTexture("org/shaman/terrain/grass.jpg"));
ground.setMaterial(mat);
ground.setLocalTranslation(-20, -20, -size/2);
ground.setShadowMode(RenderQueue.ShadowMode.Receive);
rootNode.attachChild(ground);
}
示例9: 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);
}
示例10: 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();
}
示例11: setUpCamera
import com.jme3.input.ChaseCamera; //导入方法依赖的package包/类
/**
* Setup the camera.
*/
public void setUpCamera() {
cam.setFrustumFar(10000f);
flyCam.setEnabled(false);
// for the camera node way
/*
* CameraNode camNode = new CameraNode("CamNode", cam);
* camNode.setControlDir(ControlDirection.SpatialToCamera);
* camNode.setLocalTranslation(new Vector3f(0, 3, -20)); Quaternion quat
* = new Quaternion(); // These coordinates are local, the camNode is
* attached to the character node! quat.lookAt(Vector3f.UNIT_Z,
* Vector3f.UNIT_Y); camNode.setLocalRotation(quat);
* world.getPlayer().getPlayerNode().attachChild(camNode);
* camNode.setEnabled(true);
*/
chaseCam = new ChaseCamera(cam, world.getPlayer().getMesh(), inputManager);
world.getPlayer().setChaseCam(chaseCam);
chaseCam.setDefaultHorizontalRotation(FastMath.DEG_TO_RAD * -90);
flyCam.setEnabled(false);
chaseCam.setDefaultHorizontalRotation(FastMath.DEG_TO_RAD * -90);
chaseCam.setMinDistance(5f);
// chaseCam.setLookAtOffset(Vector3f.UNIT_Y.mult(3f));
// chaseCam.setInvertVerticalAxis(true);
// chaseCam.setRotationSpeed(5f);
chaseCam.setChasingSensitivity(5f);
chaseCam.setRotationSensitivity(15f);
chaseCam.setTrailingRotationInertia(0.5f);
chaseCam.setTrailingSensitivity(25f); // this is the one you really want
// to change to change the speed
// the camera trails behind at
chaseCam.setMaxDistance(45f);
chaseCam.setSmoothMotion(true);
chaseCam.setLookAtOffset(new Vector3f(0, 2.5f, 0));
chaseCam.setTrailingEnabled(true);
chaseCam.setMinVerticalRotation(0.05f);
chaseCam.setMaxVerticalRotation(0.6f);
// chaseCam.setZoomSensitivity(200);
world.getPlayer().setFirstPersonCam();
}