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

Matrix4.clone()

clone()方法用于创建一个当前 matrix4 的副本。

用法

matrix4.clone();

返回值

返回一个新的 matrix4 副本。

示例

const matrixA = new THREE.Matrix4();

const matrixB = matrixA.clone();

console.log(matrixA.equals(matrixB)); // 输出 true

注意事项

clone()方法会创建一个与原 matrix4 完全相同的新对象,并返回该对象。新对象的值是原对象的完全副本,包括所有属性和值。

但需要注意的是,这个新对象是一个完全独立的对象,任何对它的修改都不会影响原对象。如果需要修改原对象,需要使用 Matrix4.copy() 方法修改原对象。

const matrixA = new THREE.Matrix4();

const matrixB = matrixA.clone();

matrixB.elements[0] = 1; // 只会修改 matrixB 中的元素

console.log(matrixA.elements[0]); // 输出 0,原 matrixA 的值并未受影响