Created
March 2, 2016 02:59
-
-
Save moon-goon/1bc9f802831c64603b7d to your computer and use it in GitHub Desktop.
This file contains 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
RaycastHit hit | |
void Start () { | |
} | |
void Update () { | |
bool found = Physics.Raycast(transform.position, transform.forward, hit, 7); | |
if(!found) return; | |
string name = hit.transform.name; | |
if(name!=null && name=='Cube') { | |
var targetObj = GameObject.Find(name); | |
targetObj.transform.Rotate(0, Time.deltaTime*50, 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment