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