Created
October 17, 2014 11:48
-
-
Save kuanyingchou/797c969fd85353cb2a6a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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