BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

ArrowHelper.setDirection()

ArrowHelper.setDirection()方法用于设置ArrowHelper对象的方向。ArrowHelper代表一个箭头辅助器,通常用于指示物体的方向或者向量的方向。

语法

arrowHelper.setDirection(direction)

参数

  • direction – {Vector3} 新的箭头指向的方向。该参数必须是一个Vector3对象,指定箭头的方向。

返回值

该方法没有返回值。

示例

const origin = new THREE.Vector3(0, 0, 0);
const direction = new THREE.Vector3(1, 0, 0);
const length = 10;
const color = 0xff0000;
const arrowHelper = new THREE.ArrowHelper(direction, origin, length, color);

const newDirection = new THREE.Vector3(0, 1, 0);
arrowHelper.setDirection(newDirection);

说明

ArrowHelper.setDirection()方法用于改变ArrowHelper的方向。ArrowHelper默认是从原点指向x轴正方向。通过调用该方法,可以改变箭头指向的方向。

direction参数必须是一个Vector3对象,指定箭头的方向。这个方向向量将被规范化,使得它的长度为1。因此,指定的方向向量可以是任意的非零向量,ArrowHelper将会正确地将该向量缩放为标准长度。

参考文献

ArrowHelper - three.js docs