Probes are now viable but still a bit meh in some conceptual ways. to get it to work as a mirror I used this script: var plane : GameObject; var character : GameObject;
var offset : float;
var directionFaced : Direction;
function Update () {
if(directionFaced == Direction.X){
offset = (plane.transform.position.x - character.transform.position.x);
transform.position.x = plane.transform.position.x + offset;
transform.position.y = character.transform.position.y;
transform.position.z = character.transform.position.z;
}
if(directionFaced == Direction.Y){
offset = (plane.transform.position.y - character.transform.position.y);
transform.position.x = character.transform.position.x;
transform.position.y = plane.transform.position.y + offset;
transform.position.z = character.transform.position.z;
}
if(directionFaced == Direction.Z){
offset = (plane.transform.position.z - character.transform.position.z);
transform.position.x = character.transform.position.x;
transform.position.y = character.transform.position.y;
transform.position.z = plane.transform.position.z + offset;
}
}
//makes the possible directions
public enum Direction{
X,Y,Z
}
With the variable "plane" being the mirror surface and the "character" being the player's camera. There's a few other things I had to do to make this actually work and I go into step by step detail [in the video here][1].
[1]: https://www.youtube.com/watch?v=AmwfMpf499U
↧