the only method i’ve found (printed below) where it just gets basically the middle of the screen and if my ray cast isn’t aligned to that, then the whole aim is off.
function OnGUI ()
{
GUI.Label(Rect(Screen.width/2 , Screen.height/2,100,100),textureDisplay);
}
my shoot script(part of it)
function RayShoot()
{
var hit: RaycastHit;
//var directionRay = Camera.main.ScreenPointToRay(Screen.width/2, Screen.height/2);
var directionRay = transform.TransformDirection(Vector3.forward);
Debug.DrawRay(transform.position, directionRay * range, Color.red);
if(Physics.Raycast(transform.position, directionRay, hit, range))
{
if(hit.rigidbody)
{
hit.rigidbody.AddForceAtPosition(directionRay * force, hit.point);
hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);
}
}