From b2dbc1c8a1feb0c0596d80d5e65f3aea1a1ccafd Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Mon, 16 May 2022 12:09:51 -0500 Subject: [PATCH] Spawn entities on the ground if snap is on Previously, entities always appeared in the middle of the screen with an unlocked y-axis. Now, they will appear on the ground if snapping is enabled and the ground is in sight. --- macrovision.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/macrovision.js b/macrovision.js index 4d4856cd..952a1264 100644 --- a/macrovision.js +++ b/macrovision.js @@ -5572,9 +5572,12 @@ function prepareEntities() { if (config.lockYAxis) { yOffset = getVerticalOffset(); } else { - yOffset = config.lockYAxis - ? 0 - : config.height.toNumber("meters") / 2; + // Snap to the ground if it's visible. + if (config.groundSnap && pos2pix({x: 0, y: 0}).y < canvasHeight + 50) { + yOffset = -config.y; + } else { + yOffset = config.height.toNumber("meters") / 2; + } } displayEntity( newEntity,