VertexTangentsHelper

优质
小牛编辑
133浏览
2023-12-01

Renders arrows to visualize an object's vertex tangent vectors. Requires that tangents have been specified in a custom attribute or have been calculated using computeTangents.

This helper supports BufferGeometry only.

代码示例

const geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 );
const material = new THREE.MeshNormalMaterial();
const box = new THREE.Mesh( geometry, material );
const helper = new VertexTangentsHelper( box, 1, 0x00ffff, 1 );
scene.add( box );
scene.add( helper );

例子

WebGL / helpers

Constructor

VertexTangentsHelper( object : Object3D, size : Number, color : Hex, linewidth : Number )

object -- object for which to render vertex tangents.
size -- (optional) length of the arrows. Default is 1.
color -- hex color of the arrows. Default is 0x00ffff.
linewidth -- (optional) width of the arrow lines. Default is 1. (Setting lineWidth is currently not supported.)

Properties

See the base LineSegments class for common properties.

.matrixAutoUpdate : Object

See Object3D.matrixAutoUpdate. Set to false here as the helper is using the objects's matrixWorld.

.object : Object3D

The object for which the vertex tangents are being visualized.

.size : Number

Length of the arrows. Default is 1.

Methods

See the base LineSegments class for common methods.

.update () : null

Updates the vertex tangents preview based on the object's world transform.

Source

examples/jsm/helpers/VertexTangentsHelper.js