Search Unity

Currently have spheres, I want them to look like 2d jpegs

Discussion in 'Scripting' started by ecnalyr, Jun 1, 2010.

  1. ecnalyr

    ecnalyr

    Joined:
    May 23, 2010
    Posts:
    38
    I currently have prefab spheres in my game. The game is set up to play like a 2d game, and now I'm getting to the artwork part of the game and I want to replace the 3d looking spheres with 2d images that are able to scale along the same size as the spheres (my spheres change shape during game play).

    How would I go about placing 2d images in place of my 3d spheres without changing the behavior of the game objects?
    Would this involve making billboards?
     
  2. newbrand

    newbrand

    Joined:
    May 13, 2010
    Posts:
    70
    Is your game completely in 2D like Within A Deep Forest (which has balls :~), 100% 3D or do you want to achieve an effect like in Paper Mario? In the first case you could try orthogonal projection (hit the orthogonal checkbox of your camera in the inspector and tinker with the orthogonal size property). This approach seems to be the easiest and most headache-free by far as the behaviour of the object doesn't change in the slightest. You can then further support the flat looking effect with the correct shader (see wiki), like one of the toon shaders for instance

    If you want everything but the balls look 3d-ish, your camera behaves like a normal 2D camera and only moves along two axes/rotates along one axis at most you probably don't need billboards. Just use a plane properly aligned parallel to the camera with the ball sprite applied and a sphere/whatever collider for collision detection. This setup would probably also work for a Paper Mario effect.

    Finally, if your camera moves and rotates freely, you can use billboards to always rotate your sprites towards the camera. I think there's a script on the wiki that demonstrates this. (And then there's the SpriteManager that probably can do all that and more, search the forums. Or is it iphone only?)
     
  3. ecnalyr

    ecnalyr

    Joined:
    May 23, 2010
    Posts:
    38
    (quick reply while I have a moment at a computer) It is for iPhone only.