Transform
- childCount
- DetachChildren
- eulerAngles
- Find
- forward
- InverseTransformDirection
- InverseTransformPoint
- IsChildOf
- localEulerAngles
- localPosition
- localRotation
- localScale
- localToWorldMatrix
- LookAt
- lossyScale
- parent
- position
- right
- root
- RotateAround
- Rotate
- rotation
- TransformDirection
- TransformPoint
- Translate
- up
- worldToLocalMatrix
Transform.forward 向前
var forward : Vector3
Description描述
The blue axis of the transform in world space.
在世界空间坐标变换的蓝色轴。也就是z轴。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public void Awake() {
rigidbody.velocity = transform.forward * 10;
}
}
// Set's the rigidbody velocity to be
// along the blue axis of the transform
//设置刚体的速度沿着物体的蓝色轴移动
rigidbody.velocity = transform.forward * 10;
另一个例子:
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float angleBetween = 0.0F;
public Transform target;
void Update() {
Vector3 targetDir = target.position - transform.position;
angleBetween = Vector3.Angle(transform.forward, targetDir);
}
}
// Computes the angle between the target transform and this object
//计算目标变换和这个物体之间的角度
var angleBetween = 0.0;
var target : Transform;
function Update () {
var targetDir = target.position - transform.position;
angleBetween = Vector3.Angle (transform.forward, targetDir);
}
最后修改:2011年1月16日 Sunday 17:54