Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Three JS size of objects(PlaneGeometry)?

I have question about the sizes:

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

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

    plane.doubleSided = true;
    plane.tile = tile;

So the question is : the sizes of PlaneGeometry, not in pixels right? When I have canvas aroun 500x500, it will be less than 50x50 in the end?

PS> One more question, how to get size of element when it's already added to scene? Thank you!

like image 409
MoonSilver Avatar asked Dec 21 '22 17:12

MoonSilver


1 Answers

50x50 is not pixels. It's "units". Whatever you want a "unit" to be (it's relative to the size of other objects).

If you want to resize an object in a controlled way, you could do this:

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

plane.scale.x = 50;
plane.scale.y = 50;
like image 181
mrdoob Avatar answered Jan 01 '23 14:01

mrdoob