Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Move and rotate a new infinite plane via editor

Discussion in 'Editor & General Support' started by valter-home, May 31, 2019.

  1. valter-home

    valter-home

    Joined:
    Sep 22, 2015
    Posts:
    73
    Hello everyone, I would need a clarification.
    In the MonoBehaviour linked to my unity editor I have this code:
    Code (CSharp):
    1. [HideInInspector] public Vector3 v3inNormal = Vector3.up;
    2. [HideInInspector] public Vector3 v3inPoint= Vector3.zero;
    3. ...
    4. void OnGUI() {
    5.    myPlane = new Plane(v3inNormal , v3inPoint);
    6.    [...]
    7. }
    In OnDrawGizmos() I create lines on the Plane to visualize it. In the Inspector I have two Vector3fields to change the position and rotation of the Plane.
    Changing v3inPoint the plane moves correctly on the three axes. I'm puzzled about the rotation of it.
    I saw that I can assign the rotation value to v3inNormal and the Plane would seem to rotate well on the X and Z axes while the Y axis does not change if the other two axes are zero. I believe this solution is wrong, though. The point where the Plane passes should not be v3inPoint?
    I searched a lot, but I didn't find any reference to the construction of inclined Planes. Is it possible or will I have to use the Plane construction by passing through three points?
    Do you have any links to suggest?
     
    Last edited: Jun 1, 2019
  2. valter-home

    valter-home

    Joined:
    Sep 22, 2015
    Posts:
    73
    Does anyone can to tell me if it is right to use the rotation in inNormal?