Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package entities;
- import org.lwjgl.input.Keyboard;
- import org.lwjgl.input.Mouse;
- import org.lwjgl.util.vector.Vector3f;
- public class Camera {
- private Vector3f position = new Vector3f(0,0,0);
- private float pitch;
- private float yaw;
- private float roll;
- public Camera() {}
- public void move() {
- float x = Mouse.getX();
- if(Keyboard.isKeyDown(Keyboard.KEY_W))
- position.z-=0.02f;
- if(Keyboard.isKeyDown(Keyboard.KEY_D))
- position.x+=0.02f;
- if(Keyboard.isKeyDown(Keyboard.KEY_A))
- position.x-=0.02f;
- if(Keyboard.isKeyDown(Keyboard.KEY_S))
- position.z+=0.02f;
- }
- float dx = 0.0f;
- float dy = 0.0f;
- float dt = 0.0f;
- float lastTime = 0.0f;
- float time = 0.0f;
- float mouseSensitivity = 0.05f;
- float movementSpeed = 10.0f;
- public void mouse() {
- dx = Mouse.getDX();
- dy = Mouse.getDY();
- System.out.println(dx + " " + dy);
- setYaw(dx * mouseSensitivity);
- setPitch(dy * mouseSensitivity);
- }
- public Vector3f getPosition() {
- return position;
- }
- public float getPitch() {
- return pitch;
- }
- public void setPitch(float pitch) {
- this.pitch -= pitch;
- }
- public void setYaw(float yaw) {
- this.yaw += yaw;
- }
- public float getYaw() {
- return yaw;
- }
- public float getRoll() {
- return roll;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement