本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.utils.FirstPersonCameraController类的典型用法代码示例。如果您正苦于以下问题:Java FirstPersonCameraController类的具体用法?Java FirstPersonCameraController怎么用?Java FirstPersonCameraController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FirstPersonCameraController类属于com.badlogic.gdx.graphics.g3d.utils包,在下文中一共展示了FirstPersonCameraController类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInitialize
import com.badlogic.gdx.graphics.g3d.utils.FirstPersonCameraController; //导入依赖的package包/类
@Override
protected void onInitialize() {
Gdx.input.setCursorCatched(true);
this.cameraController = new FirstPersonCameraController(level.camera);
level.camera.far = FAR_CAMERA;
level.camera.near = NEAR_CAMERA;
level.camera.fieldOfView = 70;
this.playerEntity = ForgE.entities.get("player").build(level.entities);
playerEntity.getComponent(PlayerComponent.class).camera = level.camera;
level.terrainMap.localVoxelPositionToWorldPosition(teleport.voxelPosition, playerEntity.getComponent(PositionComponent.class).vector);
playerEntity.getComponent(PositionComponent.class).vector.sub(-0.5f);
level.entities.addEntity(playerEntity);
Entity teapotEntity = ForgE.entities.get("crate-p").build(level.entities);
teapotEntity.getComponent(PositionComponent.class).vector.set(playerEntity.getComponent(PositionComponent.class).vector).add(0,1,-4);
level.entities.addEntity(teapotEntity);
}
示例2: create
import com.badlogic.gdx.graphics.g3d.utils.FirstPersonCameraController; //导入依赖的package包/类
@Override
public void create () {
spriteBatch = new SpriteBatch();
font = new BitmapFont();
modelBatch = new ModelBatch();
DefaultShader.defaultCullFace = GL20.GL_FRONT;
camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.near = 0.5f;
camera.far = 1000;
controller = new FirstPersonCameraController(camera);
Gdx.input.setInputProcessor(controller);
lights = new Environment();
lights.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
lights.add(new DirectionalLight().set(1, 1, 1, 0, -1, 0));
Texture texture = new Texture(Gdx.files.internal("data/g3d/tiles.png"));
TextureRegion[][] tiles = TextureRegion.split(texture, 32, 32);
MathUtils.random.setSeed(0);
voxelWorld = new VoxelWorld(tiles[0], 20, 4, 20);
PerlinNoiseGenerator.generateVoxels(voxelWorld, 0, 63, 10);
float camX = voxelWorld.voxelsX / 2f;
float camZ = voxelWorld.voxelsZ / 2f;
float camY = voxelWorld.getHighest(camX, camZ) + 1.5f;
camera.position.set(camX, camY, camZ);
}