Samuel M. Bednarz
Samuel M. Bednarz

Reputation: 198

Three.js - Inconsistency in updating plane size after its created has me confused

I'm setting the height and width to 100 when setting the PlaneGemoetry. Then I am scaling to the exact same size later using plane.scale(100, 100, 1);. But the scaled plane is much bigger. Why is the exact same dimensions so different? Am I doing something wrong, or is the scale values really completely different?

My expectation is that when I set the scale to 100, 100 it should not change size because that's the same size I created it at.

var geometry = new THREE.PlaneGeometry(100, 100, 2, 2 ); //<--- sets scale here
var plane = new THREE.Mesh( geometry, material );
plane.scale.set( 100, 100, 1 ); //< -- why does 100, 100 suddenly turn into a completely 

Here's a codepen for the issue: https://codepen.io/carelesscourage/pen/zYLbZBv

enter image description here

Upvotes: 0

Views: 41

Answers (1)

M -
M -

Reputation: 28462

Scaling is multiplicative. So your original size * scale is the equivalent of doing

100 * 100 = 10000

You’re getting a plane that’s ten thousand units wide. If you want to return to its initial size, just set the scale to 1, since 100 * 1 = 100

Upvotes: 1

Related Questions