Hey guys i'm working on the "Fun with lasers" live training archive by mike gieg. However i am doing it in 2d for my game. this is what i have. Code (CSharp): line1.enabled = true; line2.enabled = true; Ray2D ray1 = new Ray2D(line1.transform.position, line1.transform.up); Ray2D ray2 = new Ray2D(line2.transform.position, line2.transform.up); RaycastHit2D hit1; RaycastHit2D hit2; line1.SetPosition (0, ray1.origin); if(Physics2D.Raycast(ray1, out hit1, 50f)) line1.SetPosition(1, hit1.point); else line1.SetPosition (1, ray1.GetPoint(50f)); line2.SetPosition (0, ray2.origin); if(Physics2D.Raycast (ray2, out hit2, 50f)) line2.SetPosition(1, hit2.point); else line2.SetPosition (1, ray2.GetPoint(50f)); i have an error on the 2 if statements that says i can't convert a ray2D to a vector2D.
Physics.Raycast(...) has an overload function with these parameters: Physics2D.Raycast(...) only has a single function with these parameters: http://docs.unity3d.com/ScriptReference/Physics2D.Raycast.html http://docs.unity3d.com/ScriptReference/Physics.Raycast.html You are going to have to use the origin/direction (i.e. the parameters you're passing to form the ray) rather than a ray in the raycast.