public static Vector3 Reflect (Vector3 inDirection, Vector3 inNormal);



inNormal 向量定义一个平面 (平面的法线是垂直于其表面的向量)。inDirection 向量被视为进入该平面的定向箭头。 返回值是与 inDirection 大小相等、方向为其反射方向的向量。

\ 矢量从平面反射。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Transform originalObject; public Transform reflectedObject;

void Update() { // Makes the reflected object appear opposite of the original object, // mirrored along the z-axis of the world reflectedObject.position = Vector3.Reflect(originalObject.position, Vector3.right); } }