3 #include <glm/gtx/transform.hpp>
18 void Entity::Velocity(const glm::vec3 &vel) {
22 void Entity::Position(const glm::vec3 &pos) {
27 void Entity::Move(const glm::vec3 &delta) {
32 void Entity::Rotation(const glm::mat4 &rot) {
36 const glm::mat4 &Entity::Transform() const {
38 transform = glm::translate(position) * rotation;
44 Ray Entity::Aim() const {
46 glm::vec4 from = transform * glm::vec4(0.0f, 0.0f, 1.0f, 1.0f);
48 glm::vec4 to = transform * glm::vec4(0.0f, 0.0f, -1.0f, 1.0f);
50 return Ray{ glm::vec3(from), glm::normalize(glm::vec3(to - from)) };
53 void Entity::Update(int dt) {
54 Move(velocity * float(dt));