Skip to content

Commit

Permalink
Update rigid_body.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Rita1218 authored Jan 16, 2024
1 parent 2992b94 commit f69bc59
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/GameX/physics/rigid_body.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#include "GameX/physics/rigid_body.h"
#include <iostream>


namespace GameX::Physics {

void RigidBody::Update(float delta_time) {
position += velocity * delta_time;
if (position.y < -20.0) {
std::cout << "GAME OVER" << std::endl;
exit(1);
position = ini_position + glm::vec3{0.0f, 5.0f, 0.0f};
velocity = glm::vec3{0.0f, 0.0f, 0.0f};
angular_velocity = glm::vec3{0.0f, 0.0f, 0.0f};
orientation = glm::mat3{1.0f};
}
orientation = Base::Rotate(angular_velocity * delta_time) * orientation;
}
Expand Down

0 comments on commit f69bc59

Please sign in to comment.