Deviltrigger
Deviltrigger

Reputation: 63

How to get the width and height of cube?

i have a cube geometry and a mesh, and i don't know how to get the width. This is the code:

geometry = new THREE.CubeGeometry( 200, 200, 200 );
material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
mesh = new THREE.Mesh( geometry, material );

Upvotes: 2

Views: 221

Answers (2)

mrdoob
mrdoob

Reputation: 19602

You can use scale instead.

geometry = new THREE.CubeGeometry( 1, 1, 1 );
material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
mesh = new THREE.Mesh( geometry, material );
mesh.scale.x = 200;
mesh.scale.y = 200;
mesh.scale.z = 200;

Upvotes: 2

JonR
JonR

Reputation: 76

Not sure I understand your question correctly, but you just specified your cube with the dimensions 200 by 200 by 200, so you got your width and height right there.

Upvotes: 1

Related Questions