Chris
Chris

Reputation: 323

Adding 3D to 2D game

I am making a top-down platformer game using sprites. I would like to add some 3d elements to add depth to the platforms, by drawing the platforms as pillars that extend down into the abyss. The concept is illustrated in the image below.

My problem arises in trying to align the top of the 3d model with the platform sprite. How would I design a system that automatically creates a pillar in the proper position whenever I draw a platform object?

Sample image

Upvotes: 3

Views: 726

Answers (1)

Joel Martinez
Joel Martinez

Reputation: 47809

You will want to get a bit more sophisticated in how you render the sprites in your world. A great example of how to fuse 2d spritebatch rendering with 3d can be found on Shawn Hargreave's blog here:
https://blogs.msdn.com/b/shawnhar/archive/2011/01/12/spritebatch-billboards-in-a-3d-world.aspx

You can move sprites to any 3D position by applying the appropriate transforms to this vertex data. If you have a detailed understanding of shader coordinate systems, you now know how to position text in a 3D world or use SpriteBatch for 3D particle systems.

Upvotes: 2

Related Questions