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

994 detect collisions for voxel vs voxel and voxel vs box #1282

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joaomanita
Copy link
Contributor

Description

Added a voxel collision shape which decomposes a voxel grid into a set of boxes to be used in collision detection.
Added a greedy meshing like algorithm to do the decomposing into boxes.
Added systems to detect collisions between voxel collision shapes and box shapes, and voxel-voxel.

Checklist

  • Self-review changes.
  • Evaluate impact on the documentation.
  • Ensure test coverage.
  • Write new samples.
  • Add entry to the changelog's unreleased section.

@joaomanita joaomanita requested review from fallenatlas, a team and RiscadoA as code owners July 7, 2024 17:08
@joaomanita joaomanita linked an issue Jul 7, 2024 that may be closed by this pull request
Copy link
Contributor

@luishfonseca luishfonseca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a sample to be approved, I want to play a bit with it before.
The code overall looks quite nice, good job 👍

engine/src/collisions/interface/shapes/voxel.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
Copy link
Member

@RiscadoA RiscadoA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! Also mostly looks good to me, just needs a bit clean up.

engine/include/cubos/engine/collisions/shapes/voxel.hpp Outdated Show resolved Hide resolved
engine/include/cubos/engine/collisions/shapes/voxel.hpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
@RiscadoA RiscadoA marked this pull request as draft September 27, 2024 17:20
@joaomanita joaomanita force-pushed the 994-detect-collisions-for-voxel-vs-voxel branch 2 times, most recently from 559880d to 27bdc7b Compare October 7, 2024 21:36
Copy link
Contributor

github-actions bot commented Oct 7, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://GameDevTecnico.github.io/cubos/preview/pr-1282/
on branch gh-pages at 2024-10-09 14:35 UTC

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/7)

engine/include/cubos/engine/collisions/shapes/voxel.hpp Outdated Show resolved Hide resolved
engine/include/cubos/engine/collisions/shapes/voxel.hpp Outdated Show resolved Hide resolved
engine/include/cubos/engine/collisions/shapes/voxel.hpp Outdated Show resolved Hide resolved
engine/include/cubos/engine/collisions/shapes/voxel.hpp Outdated Show resolved Hide resolved
engine/include/cubos/engine/collisions/shapes/voxel.hpp Outdated Show resolved Hide resolved
engine/samples/voxel-shape-collisions/main.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (2/7)

engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (3/7)

engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (4/7)

engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (5/7)

engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (6/7)

engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (7/7)

engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
@joaomanita joaomanita force-pushed the 994-detect-collisions-for-voxel-vs-voxel branch 2 times, most recently from f555261 to b1ab269 Compare October 8, 2024 19:35
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Outdated Show resolved Hide resolved
@joaomanita joaomanita force-pushed the 994-detect-collisions-for-voxel-vs-voxel branch 2 times, most recently from 7c068bc to cf80a43 Compare October 8, 2024 20:14
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/2)

engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
engine/src/collisions/plugin.cpp Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (2/2)

engine/src/collisions/plugin.cpp Show resolved Hide resolved
@joaomanita joaomanita force-pushed the 994-detect-collisions-for-voxel-vs-voxel branch 2 times, most recently from 45a6bcf to fecd7ae Compare October 9, 2024 13:45
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/samples/voxel-shape-collisions/main.cpp Outdated Show resolved Hide resolved
engine/samples/voxel-shape-collisions/main.cpp Outdated Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Show resolved Hide resolved
engine/src/collisions/narrow_phase/plugin.cpp Show resolved Hide resolved
@joaomanita joaomanita force-pushed the 994-detect-collisions-for-voxel-vs-voxel branch from fecd7ae to fa5732f Compare October 9, 2024 13:57
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

@joaomanita joaomanita force-pushed the 994-detect-collisions-for-voxel-vs-voxel branch from fa5732f to 9a654da Compare October 9, 2024 14:33
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
engine/src/collisions/plugin.cpp Outdated Show resolved Hide resolved
@joaomanita joaomanita force-pushed the 994-detect-collisions-for-voxel-vs-voxel branch from 9a654da to 8f5a1f1 Compare October 9, 2024 14:59
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

{
for (uint z = start.z; z <= end.z; z++)
{
if (grid.get({end.x + 1, y, z}) == 0U || processed[end.x + 1][y][z])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ bugprone-misplaced-widening-cast ⚠️
either cast from unsigned int to std::vector::size_type (aka unsigned long) is ineffective, or there is loss of precision before the conversion

{
for (uint z = start.z; z <= end.z; z++)
{
if (grid.get({x, end.y + 1, z}) == 0U || processed[x][end.y + 1][z])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ bugprone-misplaced-widening-cast ⚠️
either cast from unsigned int to std::vector::size_type (aka unsigned long) is ineffective, or there is loss of precision before the conversion

{
for (uint y = start.y; y <= end.y; y++)
{
if (grid.get({x, y, end.z + 1}) == 0U || processed[x][y][end.z + 1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ bugprone-misplaced-widening-cast ⚠️
either cast from unsigned int to std::vector<bool, type-parameter-0-0>::size_type (aka unsigned long) is ineffective, or there is loss of precision before the conversion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detect collisions for Voxel vs Voxel
3 participants