1
0
Fork 0

Implement moving the player

Player: Add rotation and linear speeds, as well as their current state.
Player: Allow to move in the local coordinates and compute
    world-speed equivalent.
Player: Update movement axis while rotating.

World: Add a function to advance a step.
Main: Handle key events, add world step in the main loop.
This commit is contained in:
trotFunky 2024-01-21 22:11:46 +00:00
parent b359ff171f
commit 804f0272f8
5 changed files with 80 additions and 3 deletions

View file

@ -17,6 +17,14 @@ public:
float y;
float orientation;
float moveSpeed = 5;
float rotationSpeed = 180;
float currentMoveSpeedX = 0;
float currentMoveSpeedY = 0;
float currentRotationSpeed = 0;
/* View properties. */
float fov = 70;
float sensorSize = 0.035; /* 35mm, about equivalent to human eye ? */
@ -24,6 +32,7 @@ public:
void move(float dx, float dy);
void rotate(float alpha);
void updateSpeed(float localX, float localY);
};