Vector3.Reflect Manual     Reference     Scripting  
Scripting > Runtime Classes > Vector3
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.

JavaScript
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)