mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-07 19:21:14 -04:00
Actually fix formatting (for real this time)
This commit is contained in:
parent
fe23c5eb17
commit
5c2e165ba2
@ -63,7 +63,7 @@ pub const collision = struct {
|
|||||||
pub fn extent(self: AABB) Vec3d {
|
pub fn extent(self: AABB) Vec3d {
|
||||||
return (self.max - self.min)*@as(Vec3d, @splat(0.5));
|
return (self.max - self.min)*@as(Vec3d, @splat(0.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn intersects(self: AABB, other: AABB) bool {
|
pub fn intersects(self: AABB, other: AABB) bool {
|
||||||
var i: usize = 0;
|
var i: usize = 0;
|
||||||
while(i < 3) : (i += 1) {
|
while(i < 3) : (i += 1) {
|
||||||
@ -95,7 +95,7 @@ pub const collision = struct {
|
|||||||
if(blockAABB.intersects(entityAABB)) {
|
if(blockAABB.intersects(entityAABB)) {
|
||||||
const dotMin = vec.dot(directionVector, blockAABB.min);
|
const dotMin = vec.dot(directionVector, blockAABB.min);
|
||||||
const dotMax = vec.dot(directionVector, blockAABB.max);
|
const dotMax = vec.dot(directionVector, blockAABB.max);
|
||||||
|
|
||||||
const distance = @min(dotMin, dotMax);
|
const distance = @min(dotMin, dotMax);
|
||||||
|
|
||||||
if(distance < minDistance) {
|
if(distance < minDistance) {
|
||||||
@ -105,7 +105,6 @@ pub const collision = struct {
|
|||||||
resultBox = resultBox.?.join(blockAABB);
|
resultBox = resultBox.?.join(blockAABB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return .{.box = resultBox orelse return null, .dist = minDistance};
|
return .{.box = resultBox orelse return null, .dist = minDistance};
|
||||||
@ -343,7 +342,7 @@ pub const collision = struct {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user