[ADD] camera follows the only at the z position
This commit is contained in:
@@ -7,6 +7,10 @@ namespace entities
|
||||
rotation(rotation)
|
||||
{}
|
||||
|
||||
void Camera::Follow(glm::vec3 follow_position) {
|
||||
position.z = follow_position.z + 200;
|
||||
}
|
||||
|
||||
void Camera::Move(GLFWwindow* window)
|
||||
{
|
||||
float movement_speed = 0;
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace entities
|
||||
* @param window: The OpenGL window
|
||||
*/
|
||||
void Move(GLFWwindow* window);
|
||||
|
||||
void Follow(glm::vec3 follow_position);
|
||||
|
||||
inline glm::vec3 GetPosition() const{ return position; }
|
||||
inline glm::vec3 GetRotation() const{ return rotation; }
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace entities
|
||||
}
|
||||
glm::vec3 main_character::move(GLFWwindow* window)
|
||||
{
|
||||
float movement_speed = 0;
|
||||
float up_down_speed = 0;
|
||||
float movement_speed = -1.0f;
|
||||
float up_down_speed = -0.4f;
|
||||
float side_speed = 0;
|
||||
|
||||
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
||||
@@ -42,6 +42,10 @@ namespace entities
|
||||
{
|
||||
up_down_speed += UP_SPEED;
|
||||
}
|
||||
if (glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS)
|
||||
{
|
||||
up_down_speed -= UP_SPEED;
|
||||
}
|
||||
IncreasePosition(glm::vec3(side_speed, up_down_speed, movement_speed));
|
||||
return glm::vec3(side_speed, up_down_speed, movement_speed );
|
||||
}
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
|
||||
namespace entities
|
||||
{
|
||||
|
||||
class main_character : public CollisionEntity {
|
||||
const int SPEED = 10;
|
||||
const float SPEED = 1.0f;
|
||||
const float UP_SPEED = 1.0f;
|
||||
public:
|
||||
main_character(const models::TexturedModel& model, const glm::vec3& position,
|
||||
|
||||
Reference in New Issue
Block a user