Unity Error CS1729 The Type 'Plane' does not contain a constructer that takes 2 arguments
Hello,
I'm really new in scripting with unity3d and have an error in creating a new plane.. my code looks like:
private static float Distance(float xOffset, float yOffset, Vector3 position, Transform camera)
{
Handles.BeginGUI();
Vector2 point = HandleUtility.WorldToGUIPoint(position);
point.x += xOffset;
point.y += yOffset;
Ray ray = HandleUtility.GUIPointToWorldRay(point);
Plane plane = new Plane(-camera.forward, position);
float distance = 0.0f;
Vector3 hitPoint = Vector3.zero;
if (plane.Raycast(ray, out distance)){
hitPoint = ray.GetPoint(distance);
}
Handles.EndGUI();
return Vector3.Distance(position, hitPoint);
}
Have you any idea how to fix it? A second error is causing 3 lines later in the if-Statement: error CS1061: Type Plane' does not contain a definition for
Raycast' and no extension method Raycast' of type
Plane' could be found (are you missing a using directive or an assembly reference?)
Thank you very much!
Comment