|
@@ -37,7 +37,7 @@ void World::removeEntity(Entity* e) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-List<CollisionBox> World::getBoxes(const CollisionBox& box) const {
|
|
|
+List<Box> World::getBoxes(const Box& box) const {
|
|
|
int minX = floorf(box.getMin()[0]);
|
|
|
int minY = floorf(box.getMin()[1]);
|
|
|
int minZ = floorf(box.getMin()[2]);
|
|
@@ -45,7 +45,7 @@ List<CollisionBox> World::getBoxes(const CollisionBox& box) const {
|
|
|
int maxY = floorf(box.getMax()[1]);
|
|
|
int maxZ = floorf(box.getMax()[2]);
|
|
|
|
|
|
- List<CollisionBox> boxes;
|
|
|
+ List<Box> boxes;
|
|
|
for(int x = minX; x <= maxX; x++) {
|
|
|
for(int y = minY; y <= maxY; y++) {
|
|
|
for(int z = minZ; z <= maxZ; z++) {
|
|
@@ -70,8 +70,8 @@ void World::tick() {
|
|
|
}
|
|
|
|
|
|
Vector3 World::limitMove(const Entity& e, Vector3 move) const {
|
|
|
- CollisionBox box = e.getCollisionBox();
|
|
|
- List<CollisionBox> boxes = getBoxes(box.expand(move));
|
|
|
+ Box box = e.getBox();
|
|
|
+ List<Box> boxes = getBoxes(box.expand(move));
|
|
|
if(boxes.getLength() == 0) {
|
|
|
return move;
|
|
|
}
|
|
@@ -90,8 +90,8 @@ Vector3 World::limitMove(const Entity& e, Vector3 move) const {
|
|
|
realMove[0] += move[0];
|
|
|
move[0] = 0.0f;
|
|
|
}
|
|
|
- CollisionBox moved = box.offset(realMove);
|
|
|
- for(const CollisionBox& box : boxes) {
|
|
|
+ Box moved = box.offset(realMove);
|
|
|
+ for(const Box& box : boxes) {
|
|
|
if(box.collidesWith(moved)) {
|
|
|
move[0] = 0.0f;
|
|
|
realMove = old;
|
|
@@ -111,7 +111,7 @@ Vector3 World::limitMove(const Entity& e, Vector3 move) const {
|
|
|
move[1] = 0.0f;
|
|
|
}
|
|
|
moved = box.offset(realMove);
|
|
|
- for(const CollisionBox& box : boxes) {
|
|
|
+ for(const Box& box : boxes) {
|
|
|
if(box.collidesWith(moved)) {
|
|
|
move[1] = 0.0f;
|
|
|
realMove = old;
|
|
@@ -131,7 +131,7 @@ Vector3 World::limitMove(const Entity& e, Vector3 move) const {
|
|
|
move[2] = 0.0f;
|
|
|
}
|
|
|
moved = box.offset(realMove);
|
|
|
- for(const CollisionBox& box : boxes) {
|
|
|
+ for(const Box& box : boxes) {
|
|
|
if(box.collidesWith(moved)) {
|
|
|
move[2] = 0.0f;
|
|
|
realMove = old;
|