bug: level raycast is messed up when the tiles don't have `topleft` anchor
dragoncoder047 opened this issue · 2 comments
dragoncoder047 commented
add to mazeRaycastedLight example
const level = addLevel(
createMazeLevelMap(15, 15, {}),
{
pos: vec2(100, 100),
tileWidth: TILE_WIDTH,
tileHeight: TILE_HEIGHT,
tiles: {
"#": () => [
sprite("steel"),
tile({ isObstacle: true }),
+ anchor("center"),
],
},
},
);
const bean = level.spawn(
[
sprite("bean"),
anchor("center"),
pos(32, 32),
tile(),
agent({ speed: 640, allowDiagonals: true }),
+ anchor("center"),
"bean",
],
1,
1,
);
and the raycasted light bubble will be in the wrong spots
dragoncoder047 commented
Also, it doesn't obey area scales
mflerackers commented
This is because it is a voxel raycaster, it traces rays along the voxels of the level (the grid) and looks only at grid tiles which are hit.
This example is set up to render some tiles as solid. These tiles lie on the grid, it doesn't matter where the sprite is. It doesn't look at the sprite. The raycaster only sees solid tiles and areas, not sprites.