该方法将当前矩阵的值复制到给定的矩阵中。
Matrix4.copy(matrix)
matrix
:需要将当前矩阵复制到的目标矩阵。const matrixA = new Matrix4();
const matrixB = new Matrix4();
matrixA.set(
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16
);
matrixA.copy(matrixB);
console.log(matrixB.elements);
// output: [
// 1, 2, 3, 4,
// 5, 6, 7, 8,
// 9, 10, 11, 12,
// 13, 14, 15, 16
// ]
matrix
参数必须是一个Matrix4实例或者与Matrix4实例具有相同结构(拥有elements
属性和长度为16)的对象。matrix
参数应该在调用该方法前被初始化,因为该方法会将当前矩阵的值复制到其上。