Search Unity

Get beginning and the end coordinates of the rectangle

Discussion in 'Scripting' started by Librain, Jan 29, 2019.

  1. Librain

    Librain

    Joined:
    Sep 10, 2018
    Posts:
    7
    Hello, how can I get the Vector3 coordinates of the beginning(A point) and end(B point) of the rectangle?
    I tried to use MeshRenderer.Bounds, but it doesn't work for me well.
     

    Attached Files:

  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    Bounds returns an axis-aligned bounding box (AABB) which lacks rotation. You can feed the results to transform.TransformPoin() to orient them properly.