Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken origin: item drop not centered #30

Open
0XDE57 opened this issue Mar 22, 2023 · 1 comment
Open

broken origin: item drop not centered #30

0XDE57 opened this issue Mar 22, 2023 · 1 comment
Assignees
Labels
Milestone

Comments

@0XDE57
Copy link
Owner

0XDE57 commented Mar 22, 2023

item drops for asteroids are not centered, they spawn off center.

problem was wrong origin for box2d body vs point (highlighted green is correct center origin, highlighted purple is incorrect off-center origin)
Image

the fix was to shift the points that define the hull by the polygon centroid:

//shift vertices to be centered around 0,0 relatively
Vector2 center = new Vector2();
GeometryUtils.polygonCentroid(hull, 0, hull.length, center);
for (int j = 0; j < hull.length; j += 2) {
    hull[j] -= center.x;
    hull[j + 1] -= center.y;
}

this fixes the issue:

Image

but this now causes issue #2 to happen in every case

@0XDE57 0XDE57 added the bug label Mar 22, 2023
@0XDE57 0XDE57 self-assigned this Mar 22, 2023
@0XDE57 0XDE57 moved this from In Progress to Done in @0XDE57's untitled space project Mar 22, 2023
@0XDE57 0XDE57 closed this as completed in 65a1352 Mar 22, 2023
0XDE57 added a commit that referenced this issue Mar 22, 2023
-makes duplication issue so bad its almost unplayble.
-remove some dead code
-notes
-remove velocity drift
@0XDE57 0XDE57 moved this from Done to In Progress in @0XDE57's untitled space project Mar 22, 2023
@0XDE57 0XDE57 reopened this Mar 22, 2023
@0XDE57 0XDE57 moved this from In Progress to Todo in @0XDE57's untitled space project Aug 24, 2023
@0XDE57 0XDE57 moved this from Todo to In Progress in @0XDE57's untitled space project Aug 25, 2023
@0XDE57 0XDE57 moved this from In Progress to Todo in @0XDE57's untitled space project Sep 23, 2023
0XDE57 added a commit that referenced this issue Nov 4, 2023
-geometry!!!
-looks like this triggers #2 / #30, produces many tiny pieces and producing many seems to lock up the engine
0XDE57 added a commit that referenced this issue Nov 4, 2023
-geometry!!!
-looks like this triggers #2 / #30?, produces many tiny pieces and producing many seems to lock up the engine or just crash
@0XDE57 0XDE57 added this to the alpha milestone Sep 30, 2024
@0XDE57 0XDE57 closed this as completed in 737c336 Oct 9, 2024
@0XDE57
Copy link
Owner Author

0XDE57 commented Oct 9, 2024

NOTE: the child polygon origin is still incorrect!

only the drops spawn location is now correct relative to the polygon.

@0XDE57 0XDE57 reopened this Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

1 participant