I am trying to add text to a scene using ModelBatch in LibGDX. To explain in more details, let's assume I have a class MyOBJ:
class MyOBJ {
private Model model;
private ModelInstance modelInstance;
public MyOBJ() {
// initialize model, texture and modelInstance.
// for simplicity let's assume this is a sphere
ModelBuilder modelBuilder = new ModelBuilder();
model = modelBuilder.createSphere(...);
instance = new ModelInstance(model);
}
public void render(ModelBatch modelBatch) {
modelBatch.render(this.instance);
}
}
Now, I want the sphere to have a text below (like a label). So that even if the camera rotates or moves, it will still be readable and below the sphere.
I know how to render text using a SpriteBatch
, however, I can't seem to integrate the SpriteBatch (which is 2D) in a 3D model.