function Update () { var hit : RaycastHit; var inSight = false var playerRelativPos =myTransform.position - target.position; if(Physics.Raycast(transform.position , playerRelativPos, hit, 1)) { if(hit.transform == GameObject.FindWithTag("Player")) { inSight = true; } what is wrong in this raycast function? it is not changing the car insight on true... I need all of the help i can get!!!
You're raycasting backwards; you want
playerRelativePos = target.position - myTransform.position;
Use the 101-010 button with code selected to format it so people can read it.
It's more efficient to test if ( hit.transform == target ) than to use a Find function in an Update loop.