I’m trying to retrieve the vertices from a geom, and add the world coordinates, but I keep getting this const error.
Traceback (most recent call last):
File "IntersectionTest.py", line 92, in <module>
checkIntersection(fromGeomNode,intoGeomNode)
File "IntersectionTest.py", line 72, in checkIntersection
v += intoGeomNode.getParent(0).getTransform().getPos()
TypeError: Cannot call VBase3.__iadd__() on a const object.
Here’s how I get the vertices:
for i in range(geomNode.getNumGeoms()):
geom = geomNode.modifyGeom(i)
vdata = geom.modifyVertexData()
vReader = GeomVertexReader(vdata, 'vertex')
for p in range(geom.getNumPrimitives()):
prim = geom.modifyPrimitive(p)
while not vReader.isAtEnd():
vtx = vReader.getData3f()
if vtx not in vtxList:
vtxList.append(vtx)
…and here’s how I’m trying to add to them…
v += intoGeomNode.getParent(0).getTransform().getPos()
David mentioned setting commands like .getGeom() to .modifyGeom(), but I still have the error. I was referring to this post:
https://discourse.panda3d.org/viewtopic.php?t=5275&highlight=const+object