Matrix4x4.SetColumn 设置列
function SetColumn (i : int, v : Vector4) : void
Description描述
Sets a column of the matrix.
设置矩阵的一列。
You use this to build transformation matrices using right, up and forward vectors:
使用这个来构建一个变换矩阵,这个矩阵使用right,up和forward向量。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Matrix4x4 matrix = new Matrix4x4();
void Start() {
matrix.SetColumn(0, transform.right);
matrix.SetColumn(1, transform.up);
matrix.SetColumn(2, transform.forward);
Vector3 p = transform.position;
matrix.SetColumn(3, new Vector4(p.x, p.y, p.z, 1));
}
}
// build a matrix from a transform.
//从一个变换构建一个矩阵
var matrix = Matrix4x4();
// Build a matrix from a transform.
//从一个变换构建一个矩阵
function Start () {
matrix.SetColumn (0, transform.right);
matrix.SetColumn (1, transform.up);
matrix.SetColumn (2, transform.forward);
var p = transform.position;
matrix.SetColumn (3, Vector4 (p.x, p.y, p.z, 1));
}
The i-th column is set from v. i must be from 0 to 3 inclusive.
第i列设置为v,i必须在0到3之间。
参见:GetColumn.
最后修改:2011年2月26日 Saturday 15:16