Hi,
We need to fade between 2 materials based on collisions.
We have started with just a timed script to do so but it’s not working properly. It should just switch between the 2 materials based on the time.
How would we go about doing this and how would it be based off collisions with layers? Would this be possible with using the Unity’s terrain.
// Blends between two materials
var material1 : Material;
var material2 : Material;
var duration = 2.0;
function Start () {
// At start, use the first material
renderer.material = material1;
}
function Update () {
// ping-pong between the materials over the duration
var lerp : float = Mathf.PingPong (Time.time, duration) / duration;
renderer.material.Lerp (material1, material2, lerp);
}