Hey folks,
I’ve been working with the roaming ralph code and I’ve got everything working with one exception, when I try to get the name of the object my ray is colliding with.
The code is:
entries = []
for i in range(self.ralphGroundHandler.getNumEntries()):
entry = self.ralphGroundHandler.getEntry(i)
entries.append(entry)
entries.sort(lambda x,y: cmp(y.getSurfacePoint(render).getZ(),
x.getSurfacePoint(render).getZ()))
if (len(entries)>0) and (entries[0].getIntoNode().getName() == "floor"):
self.ralph.setZ(entries[0].getSurfacePoint(render).getZ())
self.ralphGroundRay.setOrigin(0,0,self.ralph.getZ()+CAMHEIGHT)
print entries[0].getIntoNode().getName()
else:
self.ralph.setPos(startpos)
When I realized it wasn’t working I added the line “print entries[0].getIntoNode().getName()” to both my code and the roaming ralph example. Roaming ralph does return “Terrain” like it’s supposed to, but my code returns nothing. I can only assume that the difference is in the model that I’m using. I’m exporting my environment from 3D MAX 8 and I know my objects are named properly. Is there some way I need to modify the EGG, perhaps?