Removed actors still being hit by character controller move

I’m having some trouble when removing actors and handling controller callbacks. In my scene, I have a PxCapsuleController, and have the onShapeHit callback handled. I have a box, which when contacted by the capsule character, gets removed. The issue is that the next capsule move call actually collides with the removed box.

This is the offending call order:

mCapsuleController->move
onShapeHit - queues the box for deletion
mBoxRigidActor->release()
mScene->simulate(dt)
mScene->fetchResults(true)
mCapsuleController->move
onShapeHit - hit.shape is from the same rigid actor that was released above and the data is invalid!

Can anyone see what might be the issue here?

Cheers, eh!

PxController::invalidateCache() needs to be called, maybe

Hmmm… I don’t seem to see any invalidateCache, but maybe that’s just my version. I found reportSceneChanged, which sounds like it does a similar thing, but I keep getting

..\..\PhysX\src\NpActor.cpp (199) : invalid parameter : PxActor::registerObserver(): Specified observer already registered

spammed in my output window after a little while (only when the controller is touching a RigidActor. Any idea what that is? I only have the executable version, so can’t debug it further.

Don’t seem to be able to edit my post above. The spam is happening only after having called reportSceneChanged, and is printed during the PxController::move call.

I’ll also clarify that my original error seems to be solved, and I’m no longer hitting any deleted rigid bodies. Any info on the registerObserver spam would be greatly appreciated!

Cheers, eh!