Verified Commit c0a4f874 authored by insert's avatar insert

Test 'player movement'.

parent 09c3c1be
......@@ -81,8 +81,19 @@ fn main() {
}
}
camera.move_down(8.0 * delta);
// ! COMMIT EACH AXIS SEPARATELY
if world.check_collisions(&physics::AABB::from_radius ( camera.position, glm::vec3(0.5, 0.5, 0.5) )) {
camera.position.y = prev.y;
}
if world.check_collisions(&physics::AABB::from_radius ( camera.position, glm::vec3(0.5, 0.5, 0.5) )) {
camera.position.x = prev.x;
}
if world.check_collisions(&physics::AABB::from_radius ( camera.position, glm::vec3(0.5, 0.5, 0.5) )) {
camera.position = prev;
camera.position.z = prev.z;
}
window.clear();
......
......@@ -22,10 +22,6 @@ impl AABB {
}
pub fn collides_with(&self, AABB ( b0, b1 ): AABB) -> bool {
/*(a.minX <= b.maxX && a.maxX >= b.minX) &&
(a.minY <= b.maxY && a.maxY >= b.minY) &&
(a.minZ <= b.maxZ && a.maxZ >= b.minZ)*/
let AABB ( a0, a1 ) = self;
if a0.x <= b1.x && a1.x >= b0.x {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment