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

PositionalAudio.getRolloffFactor()

PositionalAudio.getRolloffFactor() 方法返回当前位置音频的衰减系数(rolloff factor)。

位置音频是 PositionalAudio 类型的音频对象,可以将其放置在三维空间中,使随着监听者的位置变化而相应改变听到的声音。

衰减系数是指声音随着距离的增加而减弱的程度,可以控制音频在空间中的表现效果。较高的衰减系数会使声音在距离源较远时更快地消失,较低的衰减系数会使声音在距离源较远时更长时间地衰减。

语法

positionAudio.getRolloffFactor()

返回值

  • Number: 当前位置音频的衰减系数。

示例

const listener = new THREE.AudioListener();
const position = new THREE.Vector3(0, 0, 0);
const audio = new THREE.PositionalAudio(listener);

audio.setRolloffFactor(2); // 设置衰减系数为2
console.log(audio.getRolloffFactor()); // 输出2

参考资料

Three.js Documentation - PositionalAudio.getRolloffFactor()