Here is my code of casting a ray from game object.
i know it will be pretty simple but but now this time i am stuck in there.
using UnityEngine;
public class castray : MonoBehaviour
{
void FixedUpdate()
{
Vector3 fwd = transform.TransformDirection(Vector3.forward);
if (Physics.Raycast(transform.position, fwd, 10))
Debug.DrawRay(transform.position, fwd, Color.green);
}
}
thanks in advance.