Unity render pipeline upgrade, velocity based vignette system (may encounter problems on merge)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
public class FlyWand : MonoBehaviour
|
||||
{
|
||||
|
||||
32
Assets/Project Files/Scripts/JoonasP/VignetteController.cs
Normal file
32
Assets/Project Files/Scripts/JoonasP/VignetteController.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
|
||||
public class VignetteController : MonoBehaviour
|
||||
{
|
||||
private Rigidbody player;
|
||||
public Volume vignette;
|
||||
public float threshold = 5f;
|
||||
public float maxValue = 1f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Rigidbody>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(vignette.profile.TryGet(out Vignette vig)) //https://www.youtube.com/watch?v=8S22Qt_-nY8
|
||||
{
|
||||
float value = (Mathf.Abs(player.velocity.x) + Mathf.Abs(player.velocity.y) + Mathf.Abs(player.velocity.z)) / threshold;
|
||||
if (value > maxValue) value = maxValue;
|
||||
|
||||
vig.intensity.Override(value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25d8a8d9dfb3e574f952521e9883724f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user