Skip to content

Instantly share code, notes, and snippets.

@Happsson
Created December 8, 2019 11:42
Show Gist options
  • Save Happsson/7613db137057fbe1debfe1f0c7b06a4c to your computer and use it in GitHub Desktop.
Save Happsson/7613db137057fbe1debfe1f0c7b06a4c to your computer and use it in GitHub Desktop.
part of day 6 of AoC 2019 in unity.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SphereRotate : MonoBehaviour
{
float speed = 5;
Vector3 euls;
// Update is called once per frame
private void Start()
{
euls = transform.localEulerAngles;
speed = 0.5f;
}
public void SetColor(Color c)
{
GetComponent<Renderer>().material.color = c;
GetComponent<TrailRenderer>().startColor = c;
GetComponent<TrailRenderer>().startWidth = 1f;
}
void Update()
{
euls.z += Time.deltaTime * speed;
transform.localEulerAngles = euls;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment