Hello. I have a RayCast script. It works, but it needs a little touching up. The script is listed below. But my question is, how do I change the Projection from the Mouse pointer to the center of the screen? I’m sorry, I am just starting to learn JavaScript. And I’m 12!!! Thanks!
function Update(){
if(Input.GetMouseButtonDown(2)){ // if the LEFT button pressed
// casts a ray from the mouse pointer
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit: RaycastHit;
if(Physics.Raycast(ray, hit)){ // if something hit, send the message
hit.collider.SendMessageUpwards(“ApplyDamage”, 20, SendMessageOptions.DontRequireReceiver);
}
}
}