Can someone here give me a link to a tutorial on shooting with raycasts? I don’t want wanna script from anyone unless its bare to the bones. I don’t know to much about raycasts if anyone can point to a video tutorial or somewhere helpful in unity documentation that would be great. Thank you -jimmyismike
Think of it this way…
var hit : RaycastHit // This will store the thing we hit with our Raycast if(Physics.Raycast // If we hit something (transform.position, // Start the ray from this transform's position transform.forward, // Fire it forward hit, // Save the thing we hit in the the variable we created 100) // This is the length of the ray we fire
If the ray we fire hits something then we now have the RaycastHit variable hit. We can now use this to access the object.
hit.collider.transform // This is the transform of the object we hit. Do with this as you will!