How to make a dynamic 2d rectangle based on mouse coordinates?

I need to draw a rectangle based on mouse coordinates when the user hit Ctrl+ mouse drag?

Hi !

To draw a rectangle : PlaneBufferGeometry
To select an object in your scene from the mouse coordinates : Raycaster
There is sample code in the doc pages.
To update the position of an object in the scene, just do object.position.set( x, y, z );

1 Like

Take a look at this SO answer for some ideas:

1 Like