public void UpdateViewMatrix(float4x4 localToWorld)
        {
            worldToCameraMatrix = MatrixUtility.GetWorldToLocal(localToWorld);
            float4 row2 = -float4(worldToCameraMatrix.c0.z, worldToCameraMatrix.c1.z, worldToCameraMatrix.c2.z, worldToCameraMatrix.c3.z);

            worldToCameraMatrix.c0.z = row2.x;
            worldToCameraMatrix.c1.z = row2.y;
            worldToCameraMatrix.c2.z = row2.z;
            worldToCameraMatrix.c3.z = row2.w;
        }
 public void UpdateTRSMatrix()
 {
     localToWorldMatrix.c0    = new float4(right, 0);
     localToWorldMatrix.c1    = new float4(up, 0);
     localToWorldMatrix.c2    = new float4(forward, 0);
     localToWorldMatrix.c3    = new float4(position, 1);
     worldToCameraMatrix      = MatrixUtility.GetWorldToLocal(localToWorldMatrix);
     worldToCameraMatrix.c0.z = -worldToCameraMatrix.c0.z;
     worldToCameraMatrix.c1.z = -worldToCameraMatrix.c1.z;
     worldToCameraMatrix.c2.z = -worldToCameraMatrix.c2.z;
     worldToCameraMatrix.c3.z = -worldToCameraMatrix.c3.z;
 }
        public void UpdateTRSMatrix()
        {
            localToWorldMatrix.c0 = float4(right, 0);
            localToWorldMatrix.c1 = float4(up, 0);
            localToWorldMatrix.c2 = float4(forward, 0);
            localToWorldMatrix.c3 = float4(position, 1);
            worldToCameraMatrix   = MatrixUtility.GetWorldToLocal(localToWorldMatrix);
            float4 row2 = -float4(worldToCameraMatrix.c0.z, worldToCameraMatrix.c1.z, worldToCameraMatrix.c2.z, worldToCameraMatrix.c3.z);

            worldToCameraMatrix.c0.z = row2.x;
            worldToCameraMatrix.c1.z = row2.y;
            worldToCameraMatrix.c2.z = row2.z;
            worldToCameraMatrix.c3.z = row2.w;
        }