Skip to content

Instantly share code, notes, and snippets.

@kuanyingchou
Created October 17, 2014 11:48
Show Gist options
  • Save kuanyingchou/797c969fd85353cb2a6a to your computer and use it in GitHub Desktop.
Save kuanyingchou/797c969fd85353cb2a6a to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class Plane : MonoBehaviour {
private Vector2 v = new Vector2(10, 10);
/*
private float radius = 50;
public float GetCircumference()
{
return 2 * radius * Mathf.PI;
}
*/
public void Start()
{
}
public void Update()
{
if(transform.parent.localEulerAngles.x > 60 ||
transform.parent.localEulerAngles.x < -60)
{
v = new Vector2(v.x, -v.y);
}
transform.parent.Rotate(new Vector3(v.y, v.x, 0) * Time.deltaTime);
RaycastHit hit;
if(Physics.Raycast(transform.position, transform.parent.position - transform.position, out hit))
{
Debug.DrawRay(transform.parent.position, hit.point, Color.green, 5);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment