Deleting a specific actor body instance in bullet solver


I need help with a following subject:

I am instancing actors and dropping them on a ‘bowl’. The physics work well and things are good. However I would like to delete, destroy, kill or vanish all the actors which are spilling over (or let’s say their ty-coordinate is under some threshold, i.e. -5). This of course for keeping the fps reasonable and to not simulating unnecessary bodies.

I’m doing the instancing from a table dat and I get the ty-coordinates and body id’s from a bullet solver chop. I thought that this would be easy by just deleting the instance table line corresponding to the body_id from bsolver chop. But I have no luck. For me it seems that there is no connection between the instance order and body_id.

Can one remove a specified instance? How it should be done? Are there any better ways to achieve the same?

Thanks for all the help!

Best way I can think of to do this is to feedback using the Bullet Solver CHOP. Once they go beyond the threshold, translate them to some location out of view, and deactivate them using the “active” channel so they are no longer a part of the simulation.

If you mean ‘active’ parameter in the instance tab, I think the actor comb doesn’t care about it. It seems to act differently than geo comps. Or am I missing something here?

No, I’m referring to the “active” channel in the Bullet Solver CHOP when you reference a Bullet Solver or Actor COMP. The active channels (and others) can be modified and fed back into the simulation using the Feedback CHOP parameter on either of the aforementioned COMPs.

There are some examples in the Bullet Solver COMP’s OP Snippets that showcase the feedbacking workflow. I’d recommend taking a look there; recycler is probably closest to your case, minus the modifying of the active channel.

Thank you! I hadn’t noticed that at all! This seems very right way to do this, but now it keeps crashing whenever I’m the first instance is going inactive… Could it be something to do with the instancing? I keep adding instances regularly.

But I will continue with the snippets, maybe I come up with something, like recycling instances or something… Thank you for now!

If you send the dmp along I can take a look to see where it’s crashing.

But yeah, I think that recycling instances is the best way to go about this, rather than continuously adding bodies. The collision callback snippet does something similar to this to simulate emission.

I’ll clean up the sketch a little bit and try to dm it to you in the evening. So far it seems to me that whenever active channel is manipulated, td freezes.

Not sure about doing this in TD, but in Unity I had to use a technique called “object pooling” for similar reasons. It recycled objects in memory after reaching a certain number to avoid crashing. Maybe google on that for python hints.

Hope this helps.

1 Like

bullet_problem_with_active_channel_220113.10.toe (7.7 KB)
TouchDesignerCrash.2021.15800.10.dmp (200.1 KB)

Here’s the files. Nice if you have time to look them. The bulletsolver should start on the Green Go-button and make one new actor instance on every second. If they go over the ‘cup’ and fall under -5, the active channel should chance to zero.


But as said, I’ll try to cycle the actors next now that I’m aware of the bullet feedback… But would be interesting to know if it could had worked this way also.

Thanks. I’ve fixed the crash - the fix will be in the official build we release, 2021.16300+. In the meantime you can work around the crash by disabling “Perform Contact Test” on the Bullet Solver COMP.

1 Like