diff --git a/Sources/Voxelotl/Player.swift b/Sources/Voxelotl/Player.swift index 14852c5..7dde219 100644 --- a/Sources/Voxelotl/Player.swift +++ b/Sources/Voxelotl/Player.swift @@ -77,15 +77,15 @@ struct Player { func checkCollisionRaycast(_ world: World, _ position: SIMD3, top: Bool) -> Optional { let dir: SIMD3 = !top ? .down : .up var org = !top ? self._position + .up * Self.height : self._position - let max: Float = Self.height + Self.epsilon + let max: Float = Self.height + Self.epsilon * 4 org.x -= Self.radius - org.y -= Self.radius + org.z -= Self.radius if let hit1 = raycast(world: world, origin: org, direction: dir, maxDistance: max) { return hit1 } org.x += Self.radius + Self.radius if let hit2 = raycast(world: world, origin: org, direction: dir, maxDistance: max) { return hit2 } org.x -= Self.radius + Self.radius - org.y += Self.radius + Self.radius + org.z += Self.radius + Self.radius if let hit3 = raycast(world: world, origin: org, direction: dir, maxDistance: max) { return hit3 } org.x += Self.radius + Self.radius if let hit4 = raycast(world: world, origin: org, direction: dir, maxDistance: max) { return hit4 }