Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
How to place TextureShape center on Shape edge. — Gideros Forum

How to place TextureShape center on Shape edge.

YanYan Member
edited June 2015 in General questions
Help, it seems i need to use Matrix, but I didnt understand how to do it, after reading manual.

The problem is: I have a figure - let say 9 vertices, I want that the texture center was attached to any vertice. Attached image.
Untitled-2.jpg
500 x 500 - 32K
Untitled-1.jpg
500 x 500 - 37K
vk.com/yan_alex

Comments

  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    The easiest way to achieve that is
    1) keep Shape's 0 coordinate on shapes center
    2) position texture using Matrix, where tx and ty are basically x and y coordinates, all other should be unity matrix, which means it should look like:
    local m = Matrix.new(1,0,0,1,x,y)
  • YanYan Member
    Great ! It attaches left upper corner of texture, so if we want place the center - we should use

    x = xCoord - textureWidth / 2
    y = yCoord - textureHeight / 2

    Thanks a lot, now my shadows are incredible ^^ !
    Снимок.JPG
    970 x 558 - 59K

    Likes: john26

    vk.com/yan_alex
    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.