Hello all,
So my question for today is how can I hide all nodes out of “render distance”? I have hundreds if not thousands of nodes in a NodePath, and I need to iterate over them and decide which ones to hide based off of the distance to the player.
Currently I have it set up as this:
for node in self.blockRenderNode.getChildren():
# get all nodes within render distance
if node.getDistance(self.camera) <= Worldvars.renderDist:
node.show()
else:
# hide nodes out of render distance
node.hide()
is there any way I can do this faster? I need this to be running parrallel to several game logic functions, and it needs to complete in less than 40 ms if possible. I am open to restructuring the way I have everything organized, but keep in mind that as the game is continued more and more nodes will be added to the game, so it needs to be fast even with 50k+ NodePaths.
Thanks in advance!