2
\$\begingroup\$

Im trying to create a game on a 3d plane but with 2d objects. I have a perspective camera and the ground plane drawn. I can't seem to get sprites onto it.

I am trying to render the sprites, then to rotate over the x axis up into the 3d world. Is this even possible the way I'm trying it? If not how can I go about achieving this?

What I'm going for is almost like a Paper Mario look for the game objects, but on a larger 3d plane.

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

The trick is to read more libgdx documentation.

I found that Decals work like sprites and do exactly what I want. They can be created from TextureRegions just like Sprites, and easily displayed with a DecalBatch.

// Load a Texture
Texture image = new Texture(Gdx.files.internal(imgPath));
// create a decal sprite
sprite = Decal.newDecal(w, h, new TextureRegion(image), true);

// create a DecalBatch to render them with just once at startup
decalBatch = new DecalBatch();

Displaying is as easy as adding to the DecalBatch, then flushing the DecalBatch.

    spriteBatch.add(AssetLoader.starDecal);
    spriteBatch.add(AssetLoader.bgDecal);
    spriteBatch.flush();
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .