Place 2D image in 3D space - not GUI, not 3D object

Hello. I’ve tried looking on the forums here to find this specific problem, but no luck!

What I am looking to do is place 2D images of various stars in a 3D space. When you move through the 3D space, the stars’ images will get smaller and larger, and move relative to the camera, but will always look the same (no rotation or 3D aspect to the object).

So I’m not looking at a GUI image, and I’m not looking to create a 3D object, but to place a 2D image in 3D space. Any clues?

there is no way to add 2d images in 3d space. u have to make a plane and add the image as a texture to it.

see this question http://answers.unity3d.com/questions/445490/is-using-onpostrender-to-draw-textures-pro-only.html i stumbled upon it by accident lol Graphics.DrawTexture(new Rect(0,0,128,128),MyTexture); when used in OnPostRender will make a new texture appear in 3d space

Hey @tanoshimi this worked beautifully, thanks. However, is it possible for you to explain it further? I like when things work just fine, but I would also like to know how and why they work.

1 Answer

1

Yes, thank you Manco - I found the solution was to put the image on a plane and then add a script to the plane which always ensured that it was facing the camera:

void Update () {
    transform.up = Camera.main.transform.position - transform.position;
    transform.forward = -Camera.main.transform.up;
}

could't be easier, just get 2DToolkit and it does it instantly