Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Threejs: How to dynamically change width and height of plane?

Is there a way to easily change width and height of plane dynamically? The code below has no effect.

plane.geometry.parameters.width = width;
plane.geometry.parameters.height = height;
like image 217
sharon Avatar asked Mar 07 '16 17:03

sharon


1 Answers

Create the plane mesh

var geometry = new THREE.PlaneGeometry( 1, 1 );

var mesh = new THREE.Mesh( geometry, material );

You can then dynamically change the dimensions by resetting the scale, like so:

mesh.scale.set( width, height, 1 );

three.js r.74

like image 181
WestLangley Avatar answered Sep 28 '22 15:09

WestLangley