advancedskrald/ChessAR/Assets/change_everything.cs

33 lines
773 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
public class change_everything : MonoBehaviour
{
private GameObject color;
private GameObject brightness;
private Renderer rend;
// Start is called before the first frame update
void Start()
{
color = GameObject.Find("color");
brightness = GameObject.Find("brightness");
rend = gameObject.GetComponent<Renderer>();
}
// Update is called once per frame
void Update()
{
var color_rot = color.transform.rotation.eulerAngles.y / 360f;
var bright_rot = brightness.transform.rotation.eulerAngles.y / 360f;
rend.material.color = Color.HSVToRGB(color_rot, 1, bright_rot);
}
}