I currently have a model rendered as a “terrain”, in which I want to place buildings on.
Since I have specific (x, y) coordinates that I want to place my buildings on, the only problem left is to get the Z-axis of the terrain so that I can offset my building accordingly.
I tried using the GeomVertexReader as such:
geomNodeCollection = self.terrain.findAllMatches('**/+GeomNode')
for nodePath in geomNodeCollection:
geomNode = nodePath.node()
for i in range(geomNode.getNumGeoms()):
geom = geomNode.getGeom(i)
vdata = geom.getVertexData()
vertex = GeomVertexReader(vdata, 'vertex')
while not vertex.isAtEnd():
v = vertex.getData3f()
However, I could not get a decent conversion from LVecBase3 to actual Points that I can use to offset the building. Is there a possible solution to this? Any built-in functions that I’m missing?