Skip to content

Use AABBs for collision - #1726

Merged
IntegratedQuantum merged 56 commits into
PixelGuys:masterfrom
codemob-dev:826-use-AABB-for-collision
Aug 15, 2025
Merged

IntegratedQuantum merged 56 commits into
PixelGuys:masterfrom
codemob-dev:826-use-AABB-for-collision

Conversation

@codemob-dev

@codemob-dev codemob-dev commented Jul 28, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #826
Fixes #495

Comment thread src/models.zig Resolved
@codemob-dev

Copy link
Copy Markdown
Contributor Author

I now generate AABBs from the mesh. Everything seems to work apart from branches, which seem to behave weirdly.

@codemob-dev
codemob-dev marked this pull request as ready for review July 28, 2025 21:44
@codemob-dev

Copy link
Copy Markdown
Contributor Author

This should be working.

Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/game.zig Resolved
@codemob-dev

Copy link
Copy Markdown
Contributor Author

I can't figure out how to get this working. I'll leave the PR open if anyone wants to try and tackle it.

Comment thread src/models.zig Resolved
@IntegratedQuantum

Copy link
Copy Markdown
Member

Could you also take a look at signs? They are the only block that is not aligned to the 16×16 grid. It appears that, because the faces are offset by 0.5 from the grid, the central face of the collision is missing on one side, which means it's divided quite iniefficiently.
Screenshot at 2025-08-11 15-51-41
Here you can see that it's not selecting the front collision box of the sign, because there is none. It appears the collision box is only generated for the back side of the sign.

@codemob-dev

Copy link
Copy Markdown
Contributor Author

It appears the collision box is only generated for the back side of the sign

Weird, I'll have to investigate that.

@codemob-dev

Copy link
Copy Markdown
Contributor Author

@IntegratedQuantum It works now, I was using the wrong grid size in one of the calculations.

@IntegratedQuantum

Copy link
Copy Markdown
Member

found another edge case for fences:
Screenshot at 2025-08-11 19-45-29
I don't think the right column should be intersecting.
Could be a fundamental limitation of the rasterizer approach though.

@codemob-dev

Copy link
Copy Markdown
Contributor Author

found another edge case for fences

Do you mean signs?

@IntegratedQuantum

Copy link
Copy Markdown
Member

yes

@codemob-dev

Copy link
Copy Markdown
Contributor Author

I don't think the right column should be intersecting.

I checked, and it's just barely intersecting.

@codemob-dev

Copy link
Copy Markdown
Contributor Author

I don't think it really matters though

Comment thread src/game.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
Comment thread src/models.zig Resolved
@IntegratedQuantum

Copy link
Copy Markdown
Member

also CI is failing

Comment thread src/renderer.zig Resolved
Comment thread src/models.zig Resolved
@IntegratedQuantum
IntegratedQuantum merged commit 83d37bc into PixelGuys:master Aug 15, 2025
@codemob-dev
codemob-dev deleted the 826-use-AABB-for-collision branch August 22, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use AABBs for collision Collision detection is broken on models with non-axis-aligned faces

3 participants