Cannot call CollisionRay.setFromLens() on a const object.

Hi all,

I just downloaded the new version 1.4.0, and, while running my app, besides noticing some nice improvements, e.g. fullscreen, i also noticed a bug.

On this line:


(where self.picker is a nodepath to a collisionnode, with a ray added as solid)
I get this error:

Traceback (most recent call last):
  File "/home/pro-rsoft/docs/Programmeren/Programs/heartseed/trunk/main/src/", line 113, in ?
  File "/usr/share/panda3d/direct/src/showbase/", line 2176, in run
  File "/usr/share/panda3d/direct/src/task/", line 930, in run
  File "/usr/share/panda3d/direct/src/task/", line 862, in step
  File "/usr/share/panda3d/direct/src/task/", line 764, in __stepThroughList
    ret = self.__executeTask(task)
  File "/usr/share/panda3d/direct/src/task/", line 684, in __executeTask
    ret = task(*task.extraArgs)
  File "/usr/share/panda3d/direct/src/showbase/", line 47, in eventLoopTask
  File "/usr/share/panda3d/direct/src/showbase/", line 41, in doEvents
  File "/usr/share/panda3d/direct/src/showbase/", line 100, in processEvent
  File "/usr/share/panda3d/direct/src/showbase/", line 240, in send
    method (*(extraArgs + sentArgs))
  File "/home/pro-rsoft/docs/Programmeren/Programs/heartseed/trunk/main/src/heartseed/", line 49, in __translator
  File "/usr/share/panda3d/direct/src/showbase/", line 240, in send
    method (*(extraArgs + sentArgs))
  File "/home/pro-rsoft/docs/Programmeren/Programs/heartseed/trunk/main/src/heartseed/", line 124, in OnClick
TypeError: Cannot call CollisionRay.setFromLens() on a const object.

A sidenote: I installed using the deb package and can’t find ppython. Is it removed or so?

Nope, this isn’t actually a bug; this is an incorrect usage. You should instead use:


This is because getSolid() returns a const reference to the CollisionSolid, while modifySolid() returns a modifiable reference. The reason we have the two different methods is so Panda can know whether to update its internal caches in case you change the CollisionSolid (as you certainly are doing in this example).


With regard to the side note: the ‘ppython’ command is no longer needed. Just use ‘python’. Same on windows, BTW.

Thanks to both of you! It works fine now.

I had thought that the original reason for ‘ppython’ was so that the panda packaged version of python wouldn’t conflict if I already had a different standalone version of python installed. Is this not supported anymore? I would still like to have my regular python and panda both on my path.

Bb2 - if that’s all you’re worried about, just rename python.exe to mypython.exe.