I have created a Raycast that starts from my camera and points foward,
now I need that the object “Gun” is oriented to the Raycast’s collision point.
for now i made this…
Ray FowardRay = new Ray(Head.transform.position, Head.transform.forward);
RaycastHit Hit;
if (Physics.Raycast(FowardRay, out Hit))
{
Debug.Log(Hit.collider.name);
Debug.Log(Hit.point);
Vector3 Point = Hit.transform.position;
Vector3 gun = Gun.transform.position;
Vector3 Direction = (Gun.transform.position - Hit.transform.position).normalized;
Ray r2 = new Ray(transform.position, Direction);
Gun.transform.eulerAngles = r2.direction;
}