27 lines
836 B
C#
27 lines
836 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class AlignmentScript : MonoBehaviour
|
|
{
|
|
Transform shuttle;
|
|
Transform landing;
|
|
GameObject quad;
|
|
// Start is called before the first frame update
|
|
void Start() {
|
|
shuttle = GameObject.Find("ShuttleTarget").transform;
|
|
landing = GameObject.Find("LandingTarget").transform;
|
|
quad = GameObject.Find("AlignmentQuad");
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update() {
|
|
var upDot = Vector3.Dot(shuttle.up, landing.up);
|
|
var forwardDot = Vector3.Dot(shuttle.forward, landing.forward);
|
|
var ratio = (upDot + forwardDot) / 2;
|
|
var color = new Color((1 - ratio)*2, ratio, 0);
|
|
quad.GetComponent<Renderer>().material.color = color;
|
|
|
|
}
|
|
}
|