Capítulo 57 de 859
Creates a tube that extrudes along a 3D curve.
class CustomSinCurve extends THREE.Curve {
getPoint( t, optionalTarget = new THREE.Vector3() ) {
const tx = t * 3 - 1.5;
const ty = Math.sin( 2 * Math.PI * t );
const tz = 0;
return optionalTarget.set( tx, ty, tz );
}
}
const path = new CustomSinCurve( 10 );
const geometry = new THREE.TubeGeometry( path, 20, 2, 8, false );
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
const mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
Constructor
| Signature |
|---|
new TubeGeometry( path : Curve, tubularSegments : number, radius : number, radialSegments : number, closed : boolean ) |
Properties
| Property | Description |
|---|---|
.parameters : Object | Holds the constructor parameters that have been used to generate the geometry. Any modification after instantiation does not change the geometry. |