- Home /
How to create animated "sprites" in a 3D environment
Hey everyone :-)
So, I'm currently toying with an idea to a simple shoot-em-up game that will have a graphical style of basically 2D sprites walking around in a 3D world. A quick example I sat up is this:
Where the stickman in this case is just a plane with a texture on it, to give it that retro 2D sprite look. However it will not be a 2.5D game, as you will be able to move on all axes (so this includes depth, too).
Basically, since I've been away from Unity for quite a while, I'm contemplating how the most practical approach would be with a game like this.
That is, can I make use of Unity3D's new 2D framework to achieve this? This way I would be able to make use of all its wonderful in-built sprite sheet and animation tools, which would be awesome. However, I wonder if it's possible to make Unity sort these sprites by depth instead of simple sorting layers?
The other route might be to simply make an animation system where you texture quads with a sprite sheet and then flip through the frames by changing the UV map coordinates or something of the like.
I'm simply wondering what approach you more experienced Unity developers would take here? Is it possible to use the new 2D framework to achieve this, or would I have to use something like quads and planes and then build an animation system?
Thank you all for your help!
Answer by jpelletier · Dec 29, 2014 at 10:39 PM
You should be able to accomplish what you are looking for with UGUI by using a canvas object with the worldspace option.
Answer by hav_ngs_ru · Dec 29, 2014 at 06:49 PM
My oldscool method :)
make a spritesheet (an image with N x M frames of animation.. like this explosion spritesheet http://www.unicornmax.com/%E0%B8%AA%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%87%E0%B9%80%E0%B8%81%E0%B8%A1%E0%B8%AA%E0%B9%8C-html5-%E0%B8%87%E0%B9%88%E0%B8%B2%E0%B8%A2%E0%B9%86-part3-%E0%B8%AA%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%87-e/explosion-sprite-sheet-i0/ )
change frames by change UV coordinates. For example - there I gave my solution http://answers.unity3d.com/questions/780905/have-to-keep-png-files-for-animation-control.html , you could use it for simple cycled animations, or make your own if you need extra animation functionality.
hav_ngs_ru, is it possible to make a 2.5D sprited character like in Doom or Duke Nukem with your method ?
what do you mean "2.5D sprited character"? does it mean a 2D sprite that walks in 3D world? In this case answer is "yes", you could create a GO with collider, rigidbody or/and other components you wish to interact a 3D world, but without $$anonymous$$eshRenderer, and make a billboard-plane with my (or your own) script, that will be always turn to camera and play given animation, to show 2D sprites.
Actualy, I'm trying to do that with the new 2D Sprite Editor of Unity.
I'm making a Sprite with a lookAt(player) condition, so the Sprite will always face me. Then I insert the sprite in an empy GameObject that I'll use to have a direction.
I change the animation according to the angle and direction of where the player and the character are. A bit tricky.
I guess that's what you're saying :p
is it possible in animator own unity3d ? my character doesnt have spritesheet , just have sprite of body part . I tried it but sorting render is not very well
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How do I stop sprite animation on last frame? 2 Answers
Most efficient way to do 2D animation 2 Answers
Anima2d: How to use a single sprite for two paws? 0 Answers
SpriteManager 2 1 Answer