If I understand your question correctly, you want to know how to correct position objects.
I made a simple ruler that shows me locations relative to the origin.
class Ruler:
"""this function draws cubes in the x and y directions alternating red,green per one Panda unit. blue every ten units and a blue bar every fifty."""
def __init__(self):
toggle = 1
countten = 0
countfifty = 0
length = 1250
for x in range(length):
cube = loader.loadModelCopy("models/cube.egg")
cube.setPos(x,0,0)
toggle = -toggle
countten += 1
countfifty += 1
if toggle == 1: color = Vec4(1,0,0,1)
else: color = Vec4(0,1,0,1)
if countten == 10:
countten = 0
color = Vec4(0,0,1,0)
if countfifty == 50:
countfifty = 0
cube.setScale(1,7,1)
color = Vec4(0,0,1,0)
cube.setColor(color)
cube.reparentTo(render)
toggle = 1
countten = 0
countfifty = 0
for y in range(length):
cube = loader.loadModelCopy("models/cube.egg")
cube.setPos(0,-y,0)
toggle = -toggle
countten += 1
countfifty += 1
if toggle == 1: color = Vec4(1,0,0,1)
else: color = Vec4(0,1,0,1)
if countten == 10:
countten = 0
color = Vec4(0,0,1,0)
if countfifty == 50:
countfifty = 0
cube.setScale(7,1,1)
color = Vec4(0,0,1,0)
cube.setColor(color)
cube.reparentTo(render)
You’ll need a unit cube model. This shouldn’t be too hard to find.
You can call in your main class like this:
measurerod = Ruler()
This helps me a lot to place objects in the scene so I know position, etc.
a warning is that the ruler is pretty graphics intensive if you need a great length I only use it for establishing the scene. Don’t leave it on if you’re not setting up the scene as it will slow it down.