hey guys, i been searching for this matter an all i find is casting a ray from camera toward the mouse position.that’s not what i want.i have empty game object which is my camera’s parent and i want to cast a ray from that empty game object toward the mouse position.(i can’t ray cast from my camera because its occupied with something else).is there any way to do that? here is the script i been working with but its not working as i needed it.
void Update()
{
Ray ray = new Ray(this.transform.position, Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, distance ,layers))
{
Debug.DrawLine(ray.origin, hit.point, Color.red);
objectToPlace.position = hit.point;
}