musicinmusic
musicinmusic

Reputation: 257

Are Plane.Set3Points and Plane constructor with parameters no longer supported in Unity3D?

I'm getting a compilation error if I try to pass the parameter to the Plane constructor or when I try to call the Set3Points method. However, I see these everywhere on the internet and I've found no mention of people having this issue or acknowledging that this has changed so I'm in doubt, maybe I'm missing something simple. Maybe I need some library? Or maybe I'm not calling them correctly.

Links to documentation:

https://docs.unity3d.com/ScriptReference/Plane.Set3Points.html https://docs.unity3d.com/ScriptReference/Plane-ctor.html

Here's what I tried:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Plane : MonoBehaviour
{

    // Use this for initialization
    void Start ()
    {
        Vector3 v1 = new Vector3(1f, 2f, 3f);
        Vector3 v2 = new Vector3(10f, 20f, 30f);

        Plane plane = new Plane(v1, v2);
    }
}

//Set3Points:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Plane : MonoBehaviour
{

    // Use this for initialization
    void Start ()
    {
        Plane plane = new Plane();

        Vector3 v1 = new Vector3(1f, 2f, 3f);
        Vector3 v2 = new Vector3(2f, 3f, 4f);
        Vector3 v3 = new Vector3(6f, 7f, 8f);

        plane.Set3Points(v1, v2, v3);
    }
}

Upvotes: 1

Views: 419

Answers (1)

Foggzie
Foggzie

Reputation: 9821

You've named your behavior Plane so its looking for the constructor of your class. You either need to rename your behavior to something else or specify that it's the Plane in UnityEngine:

UnityEngine.Plane plane = new UnityEngine.Plane(v1, v2);

Upvotes: 1

Related Questions