Rename our bounding box
This commit is contained in:
6
world.js
6
world.js
@@ -425,7 +425,7 @@ export function checkCollision(curPos, newPos, world) {
|
||||
// I guess Gontrand is about 1.7 m tall?
|
||||
// he also has a 60x60 cm axis-aligned square section '^_^
|
||||
// box is centered around the camera
|
||||
const steveBB = [
|
||||
const gontrandBB = [
|
||||
[-0.3, 0.2, -0.3],
|
||||
[-0.3, 0.2, 0.3],
|
||||
[0.3, 0.2, -0.3],
|
||||
@@ -444,7 +444,7 @@ export function checkCollision(curPos, newPos, world) {
|
||||
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const newSteve = v => v.map((x, j) => i === j ? x + newPos[j] : x + curPos[j]);
|
||||
for (const point of steveBB.map(newSteve)) {
|
||||
for (const point of gontrandBB.map(newSteve)) {
|
||||
const block = blockLookup(world, ...point);
|
||||
if (block.type !== BlockType.AIR) {
|
||||
if (i === 1 && dp[i] < 0) {
|
||||
@@ -456,7 +456,7 @@ export function checkCollision(curPos, newPos, world) {
|
||||
}
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const newSteve = v => v.map((x, j) => curPos[j] + x + dp[j]);
|
||||
for (const point of steveBB.map(newSteve)) {
|
||||
for (const point of gontrandBB.map(newSteve)) {
|
||||
const block = blockLookup(world, ...point);
|
||||
if (block.type !== BlockType.AIR) {
|
||||
dp[i] = 0;
|
||||
|
Reference in New Issue
Block a user