[Newbie] about drawing lots of cubes

Hello there,

i’ve been trying out the rotating cube from examples, and wanted to modify it to spawn a lot more cubes removing rotation.

i did hit performance issue at 10000+ cubes (9fps)
After reading somewhere (don’t remember where), i used flattenStrong() on the NodePath who made it back to 60fps
But now i’m having performance issue when creating cubes, it take too long.

So i’m wondering what i did wrong and how i can boost the things up ? if it is possible :stuck_out_tongue:

Thanks for any tips
and anyway thanks to have read me

...

def spawnCube():
	mySnode=GeomNode('square')
	mySnode.addGeomsFrom(snode)
	cube=render.attachNewNode(mySnode)
	cube.setTwoSided(True)
	cube.setPos(random.randint(-50, 50),random.randint(-100, 0),random.randint(-50, 50))
	cube.setTexture(L[random.randint(0, 10)])

...

class MyTapper(DirectObject):

...
	//Key event to spawn 1000
	def ACube(self):
		count = 0
		while (count < 1000):
			spawnCube()
			count = count + 1
		render.flattenStrong()

You can look into the RigidBodyCombiner (documented in the manual). It is meant for this kind of purpose.

If I know correctly how RigidBodyCombiner works, I remember drwr saying around 1000 bones is too much, not to mention 10000.

Hey, oh limited size, well i might be able to use multiple of them
I will take a look at this in the manual and try it
Thanks for the advice guys :smiley: