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

destructible asteroid producing too many pieces #2

Closed
0XDE57 opened this issue Nov 12, 2022 · 8 comments
Closed

destructible asteroid producing too many pieces #2

0XDE57 opened this issue Nov 12, 2022 · 8 comments
Assignees
Labels
Milestone

Comments

@0XDE57
Copy link
Owner

0XDE57 commented Nov 12, 2022

sometimes extra shards are produced when shooting asteroids. duplicate vertices?

@0XDE57 0XDE57 added the bug label Nov 12, 2022
@0XDE57
Copy link
Owner Author

0XDE57 commented Jan 6, 2023

"
Box2D expects Polygons vertices are stored with a counter clockwise winding (CCW).
We must be careful because the notion of CCW is with respect to a right-handed coordinate system with the z-axis pointing out of the plane.

The body definition gives you the chance to initialize the position of the body on creation. This has far better performance than creating the body at the world origin and then moving the body.

Caution: Do not create a body at the origin and then move it. If you create several bodies at the origin, then performance will suffer. A body has two main points of interest. The first point is the body's origin. Fixtures and joints are attached relative to the body's origin.

The second point of interest is the center of mass. The center of mass is determined from mass distribution of the attached shapes or is explicitly set with b2MassData. Much of Box2D's internal computations use the center of mass position. For example b2Body stores the linear velocity for the center of mass. When you are building the body definition, you may not know where the center of mass is located. Therefore you specify the position of the body's origin. You may also specify the body's angle in radians, which is not affected by the position of the center of mass. If you later change the mass properties of the body, then the center of mass may move on the body, but the origin position does not change and the attached shapes and joints do not move.
"

see:

        B2D::body->GetLocalCenter()
        GeometryUtils.polygonCentroid()
        
        API Addition: Polygon methods setVertex, getVertex, getVertexCount, getCentroid.
        API Addition: GeometryUtils,polygons isCCW, ensureClockwise, reverseVertices

@0XDE57
Copy link
Owner Author

0XDE57 commented Jan 25, 2023

broken origin is also affecting drops location not being centered on asteroid. shifted origin visible with b2dddebug on

EDIT: moved to it's own issue -> #30

@0XDE57
Copy link
Owner Author

0XDE57 commented Feb 11, 2023

didn't mean to close.

@0XDE57 0XDE57 reopened this Feb 11, 2023
@0XDE57 0XDE57 moved this from Todo to In Progress in @0XDE57's untitled space project Feb 11, 2023
@0XDE57 0XDE57 changed the title destructible asteroid producing too many pieces broken origin: destructible asteroid producing too many pieces, item drop not centered Feb 11, 2023
@0XDE57
Copy link
Owner Author

0XDE57 commented Feb 12, 2023

[AsteroidShatterSystem] WARNING: polygonCentroid disagreement
[AsteroidShatterSystem] Duplicate point! Discarding triangle

@0XDE57 0XDE57 changed the title broken origin: destructible asteroid producing too many pieces, item drop not centered destructible asteroid producing too many pieces Mar 22, 2023
@0XDE57
Copy link
Owner Author

0XDE57 commented Apr 18, 2023

I must ensure all shapes I pass into box2d are legal and no vertices overlap.
todo: also look into removing co-linear points?

see: erincatto/box2d#735 for hints on valid hull shapes.

@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
Copy link
Owner Author

0XDE57 commented Oct 27, 2024

its not my fault (this time!)

it's in the triangulator: libgdx/libgdx#7487

@0XDE57
Copy link
Owner Author

0XDE57 commented Oct 27, 2024

꧁TEttinger, the Temptation꧂: 126.60693f and 128.60693f have different exponent bits -- so different levels of precision...

@0XDE57 0XDE57 closed this as completed in 988d27d Oct 28, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in @0XDE57's untitled space project Oct 28, 2024
@0XDE57
Copy link
Owner Author

0XDE57 commented Oct 28, 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