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:
parent
b359ff171f
commit
804f0272f8
5 changed files with 80 additions and 3 deletions
9
Player.h
9
Player.h
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue