2D Toolkit Forum
2D Toolkit => Support => Topic started by: Malharhak on May 18, 2013, 06:55:56 pm
-
Hello
-
An easy way to go about this, just create the sprites in 3d with the rest of the objects, and then call sprite.MakePixelPerfect() every frame. This will rescale the sprite to appear pixel perfect on the main camera.
The alternative is to have a second camera (orthographic) -
use camera.WorldToScreenPoint on the first camera to get where your 3d point will be on screen, then update the position of the sprite using camera.ScreenToWorldPoint on the second (orthographic) camera. The nice thing about this method is you don't need to adjust scale.
-
1. Your sprite collection? Doesn't matter - since you're calling make pixel perfect on it, it doesn't matter what the size is set. The sprite going big/small is expected - the further away it is from the camera the bigger it must be to be pixel perfect, no?
2. You should rotate it. Again - this isn't necessary if you do option #2 from before, as you'll be drawing the sprite into a different camera.
3. You requested a way of making the sprite pixel perfect - it would be the same size everywhere on screen if it was pixel perfect, wouldn't it? i.e. 1 pixel in texture = 1 pixel on screen. Thats why it gets bigger and smaller with the perspective camera.