arskrald/AR-3/Assets/change_everything.cs

33 lines
773 B
C#
Raw Permalink Normal View History

2019-03-06 15:40:24 +00:00
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);
}
}
2019-05-18 15:19:21 +00:00