Panda PhysX

Hmmm… I have not choosen my words clear enough here, sorry.

After you called remove() on an actor is is no longer valid. It has been destroyed, and the python object is an empty shell. This means: calling ANY other method on this actor after calling remove() will cause raise an exception. Not only calling remove() a second time - ANY other method. I payed some effort on guarding every method with an assert to achive this.

This is what happens if you modify the sample 03 like you did in the above post: You press F5 key, and self.boxActor.remove() is called. The actor is destroyed now. But there is still a task running which is called once a frame, to update the simulation and to process user input. Have a look at the code:

  def updateWorld( self, task ):
    dt = globalClock.getDt( )

    self.processInput( )
    self.scene.doPhysics( dt )

    return task.cont

  def processInput( self ):
    ....
    self.boxActor.addForce( force )
    self.boxActor.addTorque( torque )

So you call addForce() AFTER calling remove() on the same actor. Raising an exception is correct here, since you can’t add a force to a destroyed actor.

I suggest you do something like this in your code:

    ...
    self.yourActor.remove()
    self.yourActor = None
    ...

Then you will probably get a different error message: a python traceback complaining that “None object has no method xyz.” The codeline shows to you where you call a method AFTER calling remove() on your actor.

enn0x