So, I’m using small planets from the Solar System sample to serve as targets, and they have a scale of 0.5. How do I use that in the function that creates points around a bigger sphere with the render as the center? As it is, the points spread around the center in a spiral pattern, but it doesn’t take into account the smaller radius of each planet, and so they overlap when rendered. Could you help me figure this out?
def renderTargets(self, points):
for each in points:
self.target = loader.loadModel("/c/Panda3D-1.8.1/samples/Solar-System/models/planet_sphere")
self.target_tex = loader.loadTexture("/c/Panda3D-1.8.1/samples/Solar-System/models/mercury_1k_tex.jpg")
self.target.setTexture(self.target_tex, 1)
self.target.setScale(0.5)
self.target.reparentTo(render)
self.target.setPos(each)
def sphereTargets(self, N):
# Define points of around a sphere as positions for targets
points = []
increment = math.pi * (3.0 - math.sqrt(5.0))
offset = 2.0/N
for n in range(N):
y = n * offset - 1.0 + (offset / 2.0)
r = math.sqrt(1 - y * y)
phi = n * increment
points.append(Point3(math.cos(phi) * r, y, math.sin(phi) * r))
self.renderTargets(points)