What i’m doing is a loop and it loads the same model multiple times assigns it to a name and then displays it where its suppose to display.
However when I do this i’m wondering what the names of the instances are. Kinda of confusing but here is the code:
while loop_count <= num_planets: #Load the planet model and render it base.planet = loader.loadModel("eve_rts/models/planets/planet_sphere.egg") base.planet.reparentTo(render) base.planet.setP(90) #Set the coor of the planet base.planet.setY(planet_pos[planet_counter]) base.planet.setX(planet_pos[planet_counter2]) #Set the planet size planet_size = random.uniform(1.0,0.3) #Get random float for planet size base.planet.setScale(planet_size,planet_size,planet_size) #Set random planet size uniformally scaled #Select a random num for the texture file name (how many textures are in the folder #Assign it to the planet then texture_num = random.randint(1,30) texture_path = "eve_rts/models/planets/textures/" + str(texture_num) + ".jpg" texture = loader.loadTexture(texture_path) base.planet.setTexture(texture, 1) #Reparent the planets to the sun so they spin WEEE base.planet.reparentTo(base.sun) #Update the counter by 1 planet_counter = planet_counter + 2 planet_counter2 = planet_counter2 + 2 loop_count = loop_count + 1
so now if i do say base.planet.setScale() it scales one of the planets so thats one of the names of the names of one of the planets.
However how do I find the other names of the planets?
And or is there an easier way of loading the same model while giving it a unique name such as planet01, planet02 etc. etc.?