Search Unity

Question Converting transform positions of sprite renderers to object positions

Discussion in 'Shader Graph' started by elevenab_unity, Jan 14, 2022.

  1. elevenab_unity

    elevenab_unity

    Joined:
    Mar 9, 2020
    Posts:
    15
    Hello, I have a query.

    Initially I have 2 sprite renderers. Say A is the parent and B is the child.
    I recorded the transform localPosition of B.

    Now I want to switch to a shader graph to draw these sprites A and B in one sprite renderer.
    The 2 sprites will overlap each other.

    I have attached a screenshot for the shader I've written so far. (1st image).
    Basically I would like to know how to convert the transform localPosition recorded to object position so I can have same output I would have with 2 sprite renderers.

    The 2nd image is the desired output.
     

    Attached Files:

    • 28.PNG
      28.PNG
      File size:
      126.7 KB
      Views:
      246
    • 26.PNG
      26.PNG
      File size:
      57.2 KB
      Views:
      252