Greetings!
I wanted to implement a "Camera Flip" mode where left is right and right is left etc. but the controls remain the same
Below is what I ended up with. It gets attached to the main camera.
Everything still works and looks fine, except the 2D fluid is now invisible.
Hoping to get some hints on where i'm going wrong.
Thanks!
I wanted to implement a "Camera Flip" mode where left is right and right is left etc. but the controls remain the same
Below is what I ended up with. It gets attached to the main camera.
Everything still works and looks fine, except the 2D fluid is now invisible.
Hoping to get some hints on where i'm going wrong.
Thanks!
Code:
//attached to MainCamera
public bool flipHorizontal; //toggle me on/off
void OnPreCull()
{
camera.ResetWorldToCameraMatrix();
camera.ResetProjectionMatrix();
Vector3 scale = new Vector3(flipHorizontal ? -1 : 1, 1, 1);
camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.Scale(scale);
}
void OnPreRender()
{
GL.invertCulling = flipHorizontal;
}
void OnPostRender()
{
GL.invertCulling = false;
}