Bevy 0.15 got support for required components! We can replace a lot of our custom-made automatic component insertion with them, reducing the number of archetype moves and making startup more efficient.
Solution
Use required components for most component initialization logic.
I have also made CollidingEntities optional, as adding it automatically for every collider wastes memory unnecessarily. It must now be added manually.
Follow-ups
Make Position and Rotation required and rework init_transforms (ran into some ordering issues, so left it to a follow-up)
Make force and impulse components optional
Make friction and restitution components optional, and default to globally defined default material properties
Migration Guide
The CollidingEntities component is no longer added automatically. To read entities that are colliding with a given entity, you must now add the CollidingEntities component for it manually.
To revert to the old behavior, you can also make CollidingEntities a required component for colliders:
Objective
Bevy 0.15 got support for required components! We can replace a lot of our custom-made automatic component insertion with them, reducing the number of archetype moves and making startup more efficient.
Solution
Use required components for most component initialization logic.
I have also made
CollidingEntities
optional, as adding it automatically for every collider wastes memory unnecessarily. It must now be added manually.Follow-ups
Position
andRotation
required and reworkinit_transforms
(ran into some ordering issues, so left it to a follow-up)Migration Guide
The
CollidingEntities
component is no longer added automatically. To read entities that are colliding with a given entity, you must now add theCollidingEntities
component for it manually.To revert to the old behavior, you can also make
CollidingEntities
a required component for colliders: