Creating a cosmetic
Using the cosmetic behaviour (+ equippable component in 1.21.2) you can create wearable cosmetics (animated too!) that rotate with the players body.
For normal hats, the minecraft:equippable
should be enough.
You can also use the filament:skin
component to make your cosmetic a skin for other items like helmets.
This section of the documentation is incomplete. Contributions are welcome! Feel free to contribute on GitHub. For now, use the example_datapack in the GitHub repo.