3 ms·
This is not specific to ECS, but comes down to the "single controller" (or single writer, single owner etc. many names) problem. Ideally you want to have one m
by BulgarianIdiot 5y ago
This is not specific to ECS, but comes down to the "single controller" (or single writer, single owner etc. many names) problem.
Ideally you want to have one modifier/controller, but you can have as many readers as you want.
When you can't have a single controller, you have several options:
1. Pass ownership. Animated components control position only by animation. Physics components control position only by physics. You can pass this control in time from physics to animation and back.
2. Express one through the other. In this case, express animation as acting on physics constraints, and let the physics engine compute the final position. This way animation becomes just another "physical force" in your game. It can be hard to do sophisticated animation this way though.
3. Have physics-specific position and animation-specific position and have the final position be computed as a formula of both. Maybe you sum them. So either one that moves from a base offset, impacts the position. This depends on what the position is of.