Ray

PowenKo, Unity3d 005-2 , Ray, get the be hited gameobject

October 29, 2011   ·   0 Comments

hit the object, and get the be hited gameobject

 if(Input.GetMouseButtonDown(0)){
            Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast (ray, out hit, 100)) {
            
	  GameObject Object_GameLogic=hit.collider.gameObject;
            }	
}

sample code: b36_1_input_ray

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Unity3D4

Amazon

adsbygoogle

Recent Posts

Categories

Amazon