function Update () {
if(Input.GetMouseButtonDown(0))
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, 100)) {
print (“Hit something”);
Instantiate(shot, hit.point, Quaternion.identity);
}
}
ok the idea was i click the mouse button down and it does a raycast then creates an object where the raycast hits, it seems to be working cause i see the clones appear in the hiarchy window but i cant see them in the game scene itself and im wondering why?
i don’t know if this will help but have you defined the bullet variable as a transform i.e:
var shot : Transform;
Then highlight your Game Object you are shooting from in your scene then from the inspector under your script drag the bullet to your transform option to populate it
k this is odd, i added some debug commands to print out where the hit point is and what collider it hit and its saying all 0s for point and null for collider but its saying it hit something. this makes no sense.