Search Unity

Question How to scale a 2d sprite on its z axis?

Discussion in '2D' started by Geniusme56, Jun 4, 2023.

  1. Geniusme56

    Geniusme56

    Joined:
    Aug 21, 2021
    Posts:
    57
    I am trying to make a 2d game, with some 2.5 game objects. As the camera moves, i want you to see different parts of an object. Sort of like this.
    How would I achieve this? I tried putting my sprite on a object as a material, but it shows the front on all the side. How would I fix this?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,674
    This effect is called parallax.

    Two ways:

    - switch to a perspective camera

    - stay with an ortho camera and simulate the parallax yourself

    Google for more.
     
  3. karderos

    karderos

    Joined:
    Mar 28, 2023
    Posts:
    376
    those are 3d objects, sorry to say you will need 3d models
     
    karliss_coldwild and Kurt-Dekker like this.
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,674
    @karderos oh I just noticed that... you're probably right!!

    But I suppose if you were really really really determined you could make a "house of cards" level out of all kinds of little 2D sprites tilted to different angles and placed at different depths!!

    So OP: yeah, you "gotta" use 3D to make 3D games, modulo doing some trickery with sprites above.

    Here was my 2.5D proof-of-concept mover: feel free to look around and tear it apart.



    Full project at:

    proximity_buttons is presently hosted at these locations:

    https://bitbucket.org/kurtdekker/proximity_buttons

    https://github.com/kurtdekker/proximity_buttons

    https://gitlab.com/kurtdekker/proximity_buttons

    https://sourceforge.net/projects/proximity-buttons/
     
  5. Geniusme56

    Geniusme56

    Joined:
    Aug 21, 2021
    Posts:
    57
    Thanks! I will check it out. What i will probably do is put the same sprite behind it.