- Home /
convert code C# to java..
convert the following c# code by converting into js..?
RaycastHit hit = new RaycastHit();
Ray ray = new Ray();
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast (ray, out hit))
{
Debug.Log("pew pew");
if (hit.collider.gameObject.name.Equals("Cube"))
{
Debug.Log("hello");
//gameObject.SendMessage("gotoBrooks");
}
}
Comment
I agree to @Ingen: the out keyword doesn't exist in unityscript, and the guy will get crazy trying to convert it.
Answer by SarperS · Jul 09, 2012 at 03:36 PM
var hit : RaycastHit = new RaycastHit();
var ray : Ray = new Ray();
if (Physics.Raycast (ray, hit)) {
Debug.Log("pew pew");
if (hit.collider.name.Equals("Cube")){
Debug.Log("hello");
//gameObject.SendMessage("gotoBrooks");
}
}