O'Reilly logo

LibGDX Game Development Essentials by Juwal Bose

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Playing with primitives

3D content is created or loaded into LibGDX as a Model class instance. The Model class has the mesh, texture, and animation data in the form of nodes arranged in a hierarchy. A Model class is rendered by creating a ModelInstance class. Let's create a new project or a new package within our existing project to play with 3D. I am using com.csharks.thrustcopter.thirdDimension.Sample3D for 3D experiments. We can create many 3D primitives in LibGDX, for example, a box, sphere, cone, cylinder, capsule, and arrow. To create a Model class in code, we will need the help of the ModelBuilder class. The following code creates a box of size (1,1,1):

ModelBuilder modelBuilder = new ModelBuilder(); Model model = modelBuilder.createBox(1f, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required