- Home /
 
               Best Answer 
              
 
              Answer by AdamOwen · Jul 18, 2011 at 02:53 AM
You can easily get information about an object that has been hit with RaycastHit.
Example:
 var ray : Ray;
 var hit : RaycastHit;
 var objectBounds : Bounds;
 
 function Update() {
     ray = Camera.main.ScreenPointToRay(Input.mousePosition);
     
     if (Physics.Raycast(ray, hit)) {
         objectBounds = hit.transform.renderer.bounds;
         Debug.Log(objectBounds);
     }
 }
You can easily switch the variable type to store different information, as well as using the RaycastHit information directly.
Answer by Suyuanhan · Jul 18, 2011 at 02:35 AM
If the Oject's Value(length,height or something else) contained in the object's script(name ObjectValue.cs add to the object,I use c#,you can try in js) you can use
 rayCasthit.collider.transform.GetComponent<ObjectValue>().length;
to get the length, but if you want the object's information without script,You may set the scale I think.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                