How can I put 2d sprites in a 3d world?

Started by
6 comments, last by mk.jr.fan 11 years, 6 months ago
Hi I'm just starting with Unity and I wanted to make a game that uses 2d sprites for the player and enemies and then use the 3d world to make the background. I have read into things like orthello 2d but I wanted to use the perspective view and not the orthographic view. Im pretty sure its possible to do but the thing is I don't know how to do it.

I haven't started with Unity to much, but I have made games before with a 2d engine and understand the logic behind coding. I know some java and javascript.

How can I achieve this in Unity?
Advertisement
I don't use Unity, but if I wanted to put a 2D sprite in a 3D world, I would make a plane and have the 2D sprite as a texture.

Make a plane like this:

flat.jpg

Then add a texture which is your 2D sprite, and you're done!
GameDev Journal: http://www.gamedev.n...-rooks-journal/

OpenChess - 1.0 done!

Classic RPG #1 - Task 9 -> January 1st 2013
The correct term to use/search for help is "billboard". I.e. you create a rectangle, apply texture and keep it always faced to camera. Normally this is used for things like UI elements (think about health bar above character's head), particles (sparks, smoke, fire) etc. but you can use it for sprites as well. More advanced billboarding uses vertex shader, but for simpler cases you can just modify the transformation of your rectangle object every frame.

Unity Wiki page about billboard: http://wiki.unity3d.com/index.php?title=CameraFacingBillboard
Lauris Kaplinski

First technology demo of my game Shinya is out: http://lauris.kaplinski.com/shinya
Khayyam 3D - a freeware poser and scene builder application: http://khayyam.kaplinski.com/

The correct term to use/search for help is "billboard". I.e. you create a rectangle, apply texture and keep it always faced to camera. Normally this is used for things like UI elements (think about health bar above character's head), particles (sparks, smoke, fire) etc. but you can use it for sprites as well. More advanced billboarding uses vertex shader, but for simpler cases you can just modify the transformation of your rectangle object every frame.

Unity Wiki page about billboard: http://wiki.unity3d....FacingBillboard

When you say build boarding is for textures and UI that makes me think when I try buildboarding with a character it won't animate. Is that true?
Remember when searching that it's "billboarding" (like a billboard), not "buildboarding".

There are various things in the Unity forums about it, e.g.:
http://answers.unity3d.com/questions/26770/prefab-billboard-with-a-transparency-texture.html
http://forum.unity3d.com/threads/1093-Importing-Image-Sequence-W-Alpha-Animated-Billboard-Texture
How difficult is this going to be and how much time would it take to use the billboarding on a character with 5 animations (walking left and right, jumping, falling, and standing still)?
Shouldn't be too difficult.

In addition to the billboarding that has been mentioned, you could use a materials mainTextureOffset to step through a sprite sheet.

The following is very a quick an example I found on youtube demonstrating this.


You could build a sprite sheet with multiple rows of animations such as: idle, walking, jumping, falling, dying, etc.

On another note, I happened to run across this interesting article some time back, a tech review of MikaMobile's Zombieville USA. I thought it was kind of neat how they used Coral Paint to create the images, then used Maya for the animation of textured planes.
looks interesting I will look into it thank you!

This topic is closed to new replies.

Advertisement