Skip to content

Modified scale resets after dragging/rotating model #427

Description

@dariuslung

Describe the bug
I am trying to modify the scale of a model in realtime, so I resorted to obj.set({scale: [x, y, z]}) and it does work as long as I don't drag or rotate the model. Otherwise it gets reset to the original value.

To Reproduce
Steps to reproduce the behavior:

  1. Add a model to threebox
  2. Manually override the scale with obj.set() or obj.scale.set()
  3. Drag or rotate the model
  4. Scale gets reset

Expected behavior
Scale should stay as set?

Relevant Code

const step = 0.1;
window.addEventListener('keydown', function (event) {
    switch (event.key) {
        case '+':
        case '=':
            // PROBLEM Resets upon moving/rotating
            curScale.x += step;
            curScale.y += step;
            curScale.z += step;
            myModel.set({ scale: [curScale.x, curScale.y, curScale.z]});
            console.log(curScale);
            tb.map.repaint = true;
            break;
        case '-':
        case '_':
            curScale.x -= step;
            curScale.y -= step;
            curScale.z -= step;
            myModel.set({ scale: [curScale.x, curScale.y, curScale.z]});
            console.log(curScale);
            tb.map.repaint = true;
            break;
    }
});
  • Version 2.2.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    🪲 bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions