Vector3.Reflect 反射
static function Reflect (inDirection : Vector3, inNormal : Vector3) : Vector3
Description描述
Reflects the vector along the normal.
沿着法线反射向量。
The returned value is inDirection reflected from a surface with a normal inNormal.
返回的值是被从带有法线inNormal的表面反射的inDirection。
C#
JavaScript
using UnityEngine;using System.Collections;public class example : MonoBehaviour {public Transform originalObject;public Transform reflectedObject;void Update() {eflectedObject.position = Vector3.Reflect(originalObject.position, Vector3.right);}}
var originalObject : Transform;var reflectedObject : Transform;function Update () {// Makes the reflected object appear opposite of the original object,// mirrored along the z-axis of the world//使反射物体出现在原始物体的对面//镜像是沿着世界的z轴reflectedObject.position = Vector3.Reflect (originalObject.position, Vector3.right);}