Search Unity

Scale Gameobject Dynamically to Match Oval Object

Discussion in '2D' started by moseskarunia, Nov 23, 2015.

  1. moseskarunia

    moseskarunia

    Joined:
    Aug 31, 2015
    Posts:
    1
    Maybe the title misleading, but I don't know what the exact sentence to state my question correctly.

    Look at below image :
    aaaa.JPG

    Basically, I want to move the orange rectangle, which is pointed by red arrow, to the direction pointed by blue arrow.

    Also, while the rectangle is moving, I want to continuously scale down its width to match the grey oval width on the rectangle Y position (depicted by rectangle duplicates above rectangle that is pointed by red arrow). It'll also have 0 width on the topmost of the grey oval.

    >> What's the best way to calculate that (mainly the oval width on certain height)?

    Thanks a lot guys!

    P.S. Think all of them as 2d objects only