Detect Fade Targets
Overview
This feature utilizes SeeThroughDetect.cs, responsible for detecting objects between the player (Target) and the camera. Fade Targets can either work by changing the opacity (Objects Fade) of the objects or by transforming masks (Other).
How To Use It
Follow these steps to set up the logic for objects fade and other effects:
Add SeeThroughDetect.cs script to any game object in your scene.
Assign camera and target transforms, and choose detection layers.
You can observe the raycast going from the camera to the player character.
Attach SeeThroughFadeTarget.cs to a new game object.
Add trigger game objects to the list. The Trigger Game Objects list includes all game objects with colliders (basically all colliders you want to trigger the fade). If any of the colliders get triggered, the fade logic is activated.
See Through Detect
The Camera Transform is the start, and the Target Transform is the end of the raycast that checks every frame if there are any objects belonging to the Detection Layer. If such an object is detected, the fade target gets triggered.
You can adjust the length of the raycast and its start and end offset. This is especially useful, for example, when the camera is inside an object collider (like a tree), as the raycast doesn't get triggered when it starts in a collider. Therefore, it needs to be offset to be outside the object in order to function properly.
See Through Fade Target
Duration determines how fast the opacity/mask transform will transition from start to the end state.
The Trigger Game Objects list includes all game objects with colliders (basically all colliders you want to trigger the fade). If any of the colliders get triggered, the fade logic (opacity and mask transform) is activated.
Opacity
Used in objects fade. You can control the opacity curve. For each renderer in the opacity renderers, a material property block with new opacity will be passed.
Mask Transform Manipulation
Used to manipulate mask transforms. You can control position, scale, and rotation. The values are linearly interpolated between start and end in the duration time of the fade.
Last updated