collisions garbage collecting

Im making a ‘jungle engine’ where i shoot a collision ray for each tree to determine its Z value on the terrain (not a geomipterrain). This works fine but I need this only for positioning the trees, after that I dont need any collision detection happening. Right now I do that by hand with

base.accept('x', base.cTrav.clearColliders)

I tried making that happen automatically, but if I put that line of code simply after the collisionHandlerFloor starts doing its job, most of the trees wont make it to the ground. How to know if they did? And what do I need to remove by hand? Do I need to remove collision solids and handlers myself, or does clearColliders do that? Or maybe theres a method for the traverser to do all that?

What I’d do is make a custom traverser. This way, I can only call traverse() once instead of once per frame, only once to determine the positions.

Are you sure about that? I think with collisionhandlerFloor the z value gradually decreases, theres no guarantee that one frame is enough.
And what about the garbage collecting?

Uh, like anything in Python, just clear all references to the objects and they will destruct.

Well I guess I dont need to use removeNode() then, huh?

You do need to remove any collision nodes from their parent nodes, because otherwise those parent nodes would still hold a reference to those collision nodes (consequently, they wouldn’t get destructed).

Exactly, so I think the “just remove the references” is misleading.

So anyway, how to find out when the trees hit the ground (dont move down anymore) to remove all that?

It’s not misleading, because the principle still applies.

There shouldn’t be any gravity with CollisionHandlerFloor, as long as the maximum velocity is set to 0 (e.g. use setMaxVel).

Okay, I think its all working now.
Just one last question, in the API ref it says:

So when I pass ‘render’ as the argument, it all works correctly, but when I pass the node to which all my tree models are reparented to (and to which the collision solids are attached), it doesnt work.

Does the terrain also parented to that node ?
If not, then how could the traverser find it and test it against the trees’ solids ?

true… true…