Can anyone explain why this is happening? Newbie with unity and am trying to do some basic raycasting. The detection looks off and I'm not sure where I'm going wrong.
	
	
	
		
So I have two objects on a plane tagged EditorOnly(I just chose a random default tag). The script(attached to the fps camera controller) draws a line in the scene view if it detects an object with that tag. For some reason its detecting the objects at an offset or something. Not sure what I'm doing wrong for this to occur.
edit: did more debugging and it looks like the raycasting is working, but the visible debug rays are incorrect. I added display red line if no object is detected, and for some reason I'm seeing this large gap between nothing and the cube. So the green line is not representive of the raycast. hmm
				
			
		Code:
	
	using UnityEngine;
using System.Collections;
public class Raycast : MonoBehaviour {
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
        RaycastHit hit;
        Vector3 fwd = transform.TransformDirection(Vector3.forward);
        
        if (Physics.Raycast(transform.position, transform.forward, out hit, 20.0f))
        {
            if (hit.collider.gameObject.tag.Equals("EditorOnly"))
            {
                Debug.DrawLine(transform.position, fwd * 10, Color.green, 20, true);
                print(hit.collider.gameObject.name);
                print(hit.point);
            }
        }
            
    }
}So I have two objects on a plane tagged EditorOnly(I just chose a random default tag). The script(attached to the fps camera controller) draws a line in the scene view if it detects an object with that tag. For some reason its detecting the objects at an offset or something. Not sure what I'm doing wrong for this to occur.
edit: did more debugging and it looks like the raycasting is working, but the visible debug rays are incorrect. I added display red line if no object is detected, and for some reason I'm seeing this large gap between nothing and the cube. So the green line is not representive of the raycast. hmm
 
	 
				 
	 
	 
	 
	 
	
 
	 
	 
	
 
	 
	 
	 
	 I'm part of the problem, apparently.
  I'm part of the problem, apparently. 
	 
	 I love creating a world and populating it with characters. Though I will admit, sometimes I think of character backgrounds and build lore around that. Like the idea of the priest group didn't come until after I made him.
 I love creating a world and populating it with characters. Though I will admit, sometimes I think of character backgrounds and build lore around that. Like the idea of the priest group didn't come until after I made him.  
	 
	 
	 
	 
	 
	