Vector3.Reflectstatic function Reflect (inDirection : Vector3, inNormal : Vector3) : Vector3DescriptionReflects the vector along the normal. The returned value is inDirection reflected from a surface with a normal inNormal.
JavaScripts
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 reflectedObject.position = Vector3.Reflect (originalObject.position, Vector3.right); } using UnityEngine;
using System.Collections; public class example : MonoBehaviour { public Transform originalObject; public Transform reflectedObject; void Update() { reflectedObject.position = Vector3.Reflect(originalObject.position, Vector3.right); } } import UnityEngine
import System.Collections class example(MonoBehaviour): public originalObject as Transform public reflectedObject as Transform def Update(): reflectedObject.position = Vector3.Reflect(originalObject.position, Vector3.right) |
