Function evosim::contorl::update::update_blob_info
source · pub fn update_blob_info(
tc_q: Query<'_, '_, (&Transform, &Collider)>,
blob_q: Query<'_, '_, (&mut BlobInfo, &Children)>,
frames: Res<'_, Frames>
)
Expand description
a bevy function
Updates the BlobInfo
for every blob component in the ECS.
This function iterates through all blob components and calculates the new mass center and velocity based on the child entities’ transforms and colliders. It also updates the move distance of the blob based on the current frame and iteration length.
it updates:
- mass_center
- velocity
- cumulated move distance (for move training usage)
Panics
This function will panic if any child of a blob does not have both a transform and collider, or if a blob does not have at least one block.