THREE JS Amateur
THREE JS Amateur

Reputation: 23

How to create a half Cylinder in Three js?

I´m very new to three js and I want to create a half Cylinder as roof.

 var geometry = new THREE.CylinderGeometry(100,100,150);
 var material = new THREE.MeshNormalMaterial();
 var cylinder = new THREE.Mesh( geometry, material);
 scene.add(cylinder);

This is the Basic Cylinder but unfortunately I couldn´t find an specific answer to a half cylinder yet. Is it possible to create this with vertices?

Upvotes: 1

Views: 2300

Answers (1)

msun
msun

Reputation: 831

The last 2 params of CylinderGeometry constructor allows this. For example:

var geometry = new THREE.CylinderGeometry(100,100,150, 8, 1, false, 0, Math.PI);

0 is the start angle and Math.PI is the end angle; i.e. half of a circle.

Upvotes: 4

Related Questions