[ADDED] rotating bounding boxes

This commit is contained in:
Menno
2021-06-08 12:22:54 +02:00
parent aa9c6a0fbb
commit 625965ed1b
4 changed files with 31 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <iostream>
#include <glm/gtc/matrix_transform.hpp>
#include "../entities/entity.h"
@@ -15,6 +16,18 @@ namespace collision
{
glm::vec3 center_pos;
glm::vec3 size;
void SetRotation(float angle)
{
double sinTheta = glm::sin(glm::radians(angle));
double cosTheta = glm::cos(glm::radians(angle));
float x = size.x * cosTheta + size.z * sinTheta;
float z = size.z * cosTheta - size.x * sinTheta;
size.x = x < 0 ? -x : x;
size.z = z < 0 ? -z : z;
}
};
/*