- Home /
Can anyone make a script that allows CameraFade
Hello,
So basically, I've been looking around, maybe not good enough.. But I've been wanting to get a script that applies as:
Player looks at GameObject, MainCamera then fades black slowly, IF Player looks away from GameObject, fades back to normal.
This is a script I want to use for the purpose of;
My character in game looks at someone and gets scared (Camera.Fade), but as he looks away he doesn't. (Camera.Fades.Back) That is a brief example.
I'm asking on here because I know there are a lot of professionals around. I also ask because every time someone tells me, I learn from it.
Break it into two parts.
Fade-to-black can be done using a transparent full-screen guiTexture. Lots of Q's here involving that. Some are fade-in, or fake full-screen blur, or Lerping an alpha ... .
"Am I looking at something" can be done using Quaternion.Angle
between the way you are looking and the line to the target (which is the same math as to see how far away something is, which you probably also want to use.)
Then you'll have to flesh out your rules (like: you have to be looking almost right at it to be terrified, but if once you are, have to have it completely off the screen to recover.) Otherwise you'll have ping-ponging fades at a certain angle.
Answer by Doeko · Jan 11, 2014 at 04:41 PM
Here is a camera fade script: http://wiki.unity3d.com/index.php/FadeInOut
However, it seems like you are posting a lot of questions of a very basic nature or even which have good examples that can be found. It is my suggestion you expend a little more effort and learn the basics, before you post a question.