Help storing the activation frame of a piece in an RBD sim

   262   2   2
User Avatar
Member
1 posts
Joined: 12月 2021
Online
Hi there, I'm looking to see if anyone has an elegant solution for storing the activation frame over pieces in an RBD sim. For example, piece40 has an @activation_frame = 1049. Let me know if you have any ideas!
- Emmett | FX Artist & Fluids Nerd
User Avatar
Member
563 posts
Joined: 11月 2016
Offline
I guess this could work, before your sim, create the attributes:

i@prev_active = 0;
f@activation_frame = -1;

Then inside your sim:

if(i@prev_active == 0 && i@active == 1) f@activation_frame = @Frame;
i@prev_active = i@active; 
Edited by Tanto - 2026年5月26日 16:53:05
User Avatar
スタッフ
458 posts
Joined: 2月 2008
Offline
The RBD Bullet Solver has an option in the output tab to export "age" and "active_age" as attributes. age is the time since the rbd piece first appeared in the sim, active_age is the time since the rbd was last activated - if you have pieces that become active, then inactive, then active again it will be reset every time it changes from inactive to active and 0 whenever the piece is inactive.
To get the active_age out of the sim, make sure you add it to the list of attributes in the output tab > transfer attributes.

From there, to get the activation frame, you can do:
@activation_frame = ((@Time - @active_age) / @TimeInc + 2) * (@active_age > 0);
  • Quick Links