|
Reflects the vector along the normal.
The returned value is inDirection reflected from a surface with a normal inNormal.
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)