Panda3d Collisions made simple

Great! This is exactly the kind of thing I could use. I’ve been afraid of collisions for a while, but looks like I have no choice now.

I don’t understand this part of the code:

#** this is where will be periodically tested the collision
def traverseTask(task=None):
  for i in range(cHandler.getNumEntries()):
    entry = cHandler.getEntry(i)
    name = entry.getIntoNode().getName()
    dlight.setColor(VBase4(0.8, 0.8, 0.8, 1))
    if task: return task.again

  dlight.setColor(VBase4(0.0, 0.0, 0.0, 1))
  if task: return task.again

The top block is skipped if range(cHandler.getNumEntries())==0, right? But then what is the point of entry and name? I # them out, and the program still works. Is it for (potentially) checking to see what different objects collided with the smiley balloon?

Also, wouldn’t it be clearer if you masked your heart with a LOVE_MASK like the red smiley instead of just a 1?