Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Absolute angle takes into account BodyComponent ancestors too (#…
…2678) Currently, the implementation of the `absoluteAngle` getter in `PositionComponent` only takes into account `PositionComponent` ancestors. The implementation simply runs through the whole hierarchy summing up the relative angles. This gives a wrong result with Forge2D because `BodyComponent`s have angles too: in the common situation where a `PositionComponent` (e.g. a `SpriteComponent`) is the child of a `BodyComponent`, the `BodyComponent`'s rotation is ignored when computing the `absoluteAngle`. The fix simply introduces a new minimal interface `HasAngle` that both `PositionComponent` and `BodyComponent` implement (`PositionComponent` implements it automatically via `AngleProvider`), and reimplements `absoluteAngle` so that it considers all ancestors with an angle and not just the `PositionComponent` ones.
- Loading branch information
1 parent
b77802a
commit 75aee76
Showing
9 changed files
with
65 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters