Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

finding the normal on a plane for two known objects

Discussion in 'Scripting' started by garrilla, Mar 17, 2019.

  1. garrilla

    garrilla

    Joined:
    Jan 12, 2016
    Posts:
    28
    I'm trying to find the 'point of reflection' on a plane for two known objects in 3space

    I can't work it out from the manual

    any guidance gratefully recieved
     
  2. WarmedxMints

    WarmedxMints

    Joined:
    Feb 6, 2017
    Posts:
    1,035
    Do you just want to centre point between two vectors? If so, just use Vector3.Lerp.
    Code (CSharp):
    1. pointOfReflection = Vector3.Lerp(ObjA.position, ObjB.position, 0.5f);
     
  3. garrilla

    garrilla

    Joined:
    Jan 12, 2016
    Posts:
    28
    I'm trying work out where the point of relection would be on a plane

    lets say I
    Vector3 plane = new vector3(0, 2, 1); // scale of 1,1,1,
    vector3 objA = new Vector3(1,1,2);
    vector3 objB = New Vector3(2,2,4);

    there is a point of reflection on the plane, a point where a normal would be if ObjA were an object of incidence and objB an object of reflection.

    think of like a ray, but instead of knowing the starting point and the direction and distance of the 1st reflection, I know only the object and its reflection, not the point the on the plane where it reflects