u/SweatyYak4068

Image 1 — Help with 3D-Engine needed.
Image 2 — Help with 3D-Engine needed.
Image 3 — Help with 3D-Engine needed.

Help with 3D-Engine needed.

Hi everyone,

I'm building a raycasting 3D engine in Scratch (similar to Wolfenstein-style rendering) and I'm running into an issue with my renderer not correctly displaying wall distances.

**How it works:**

I have a "Tracer" sprite that starts at the player's position, rotates through the field of view (46 steps), and for each ray it moves forward until it hits a black wall. The distance traveled is stored as `distwall` and written into a list called `FrameSync` at position `calc line`. Figur1 (the renderer) then reads each element from `FrameSync` and draws a vertical line with height `1000 / element` — so closer walls = taller lines.

**The problem:**

Even though the FrameSync list contains different values (e.g. 30, 36, 44, 59, 68...) that correctly reflect the distances at different angles, the rendered lines all appear to be the same height. It looks like it's only rendering the straight-ahead distance for every single column, completely ignoring corners and depth variation.

**What I've already checked:**

- The list length is correctly 46 (fixed an issue where values were being appended instead of replaced)

- The division `1000 / Element currentlycalculatedline von FrameSync` is built correctly with an operator block

- `currentlycalculatedline` now starts at 1 (not 0) so list indexing is correct

- The tracer sweep and FOV logic appears to work

**Current suspicion:**

I think `dist sens` might not be reset to 0 before each new ray is cast, causing each ray to accumulate distance from the previous one. But I'm not 100% sure.

Has anyone built a raycaster in Scratch and run into something like this? Any help appreciated! Thanks.

u/SweatyYak4068 — 22 hours ago