Skip to content

Allow configuring the scaling rate In THREE.TransformControls #5489

@blaise-io

Description

@blaise-io

I have a simple editor for 3D models using three.js. This is my camera:

new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 0.01, 10);

And this is my mesh's geometry:

new THREE.BoxGeometry(0.3, 0.3, 0.3);

I'm using THREE.TransformControls to scale the mesh.

Scaling works perfectly fine when meshes have units ~ 100, but when an object is between 0 and 1, scaling is very slow. With slow, I mean that when you drag the scale slider half the canvas size, the mesh increases or decreases only a few percentages in size. I don't have this problem with other TransformControls modes.

This is because there's a the magic number 50 in the code that translates mouse movement to scale.

Can we make this number configurable, and/or make it use a sane default based on mesh size or camera?

JSFiddle demonstrating slow scaling

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions