So I'm trying to load actor models, and eventually this class is going to get pretty big. So I really don't want to have to keep track of writing them all to my entity array(line 40), is there a more efficient way of storing my actor models. using indexing?
My code looks like this..
12. public static Entity[] callActors(Loader loader) {
13.
14. //Earth Entity Actor
15. model = OBJLoader.loadObjModel("moon", loader);
16. texture = new ModelTexture(loader.loadTexture("MoonMap1024x1024"));
17. staticModel = new TexturedModel(model,texture);
18. texture = staticModel.getTexture();
19. texture.setShineDamper(10);
20. texture.setReflectivity(0);
21. //Assigned an Entity Actor
22. Entity entity1 = new Entity(staticModel, new Vector3f(-1.40f,1,-6.0f),0,0,0,1);
23.
...
39.
40. Entity[] entityArray = {entity1,entity2,entity3};
41.
42. return entityArray;
43. }
Is there a way to use indexing like this at line 22
Entity[] entityArray[1] = new Entity(staticModel, new Vector3f(-1.40f,1,-6.0f),0,0,0,1);
instead of writing all of the actors to the entity array all at once (line 40)?
Entity[] entityArray = {entity1,entity2,entity3};is effectively the same asEntity[] entityArray = new Entity[3]; entityArray[0] = new Entity(staticModel, new ...etc); entityArray[1] = new ...etc, if that is what you are asking.