Math errors in screen-to-world projection used for cursor and object dragging

Issue #25 resolved
JP LeBreton
repo owner created an issue

(Writing up a bug for this to track work on it and centralize discussion.)

Short video demonstrating the problem:

Steps to reproduce:

  1. Launch playscii.

  2. Enable "Camera tilt" in the View menu.

  3. Move the cursor to near the top right corner of the screen.

  4. Observe: the in-world cursor (four white corners indicating a grid square) location doesn't match the user's mouse cursor location. This divergence increases the further the mouse is from the center of the screen.

Another repro, in game mode:

  1. Launch playscii and open one of the example games, eg cronotest.

  2. Select one of the objects and drag it.

  3. Observe: the dragged object's location moves at a different rate than the user's mouse cursor.

Most of the relevant code is here:

As a convenience while I'm debugging this issue, vector.screen_to_world calls a specific implementation so I can switch back to the current (0.7.3) mostly-working screen_to_world_OLD while investigating alternatives. vector.screen_to_world_NEW is the newer implementation, which produces results that are too broken to easily debug, despite being based on working examples from other codebases.

Other code that might be of interest here is in the functions used to create the view and perspective matrices:

Comments (6)

  1. JP LeBreton reporter

    Update: this is now blocking a few bits of feature work, eg zooming art to extents, tool icons on cursor, and improvements to dragging in game mode.

  2. Log in to comment