unity摄像机左右颠倒的画面

来源:互联网 发布:nginx 以rtmp方式点播 编辑:程序博客网 时间:2024/04/29 04:18
我最近刚学unity游戏开发,然后我需要将unity中摄像机输出的画面整个左右颠倒过来,不知道各位大神有什么方法?
或者可以理解为我想把一个输出的画面变为它自己的镜面效果,就是这个意思,任何方法我都可以接受!

很着急!求各位帮助,感激不尽!!!



C# code
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using UnityEngine;
using System.Collections;
 
public class MirrorCamera : MonoBehaviour {
 
    // Use this for initialization
    void Start () {
        MirrorFlipCamera(Camera.main);
    }
 
    void MirrorFlipCamera(Camera camera) {
        Matrix4x4 mat = camera.projectionMatrix;
        mat *= Matrix4x4.Scale(new Vector3(-1, 1, 1));
        camera.projectionMatrix = mat;
    }
     
    // Update is called once per frame
    void Update () {
     
    }
}


亲测成功。如果解决了记得结贴哦~

0 0