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

[collision] First generation of octree collision detection #321

Merged
merged 5 commits into from
Jun 9, 2021

Conversation

IAmNotHanni
Copy link
Member

@IAmNotHanni IAmNotHanni commented Jan 17, 2021

Closes #244
Also check out #234

Collision detection with multiple octrees

After a lot of experiments, I finally present the first generation of octree collision detection. Given N octrees, this algorithm can detect if there are collisions with any octree. If that is the case, we can extract

  • The const reference to the intersected cube.
  • The coordinates of the intersection point.
  • The index and coordinates of the selected face.
  • The index and coordinates of the nearest corner on that face.
  • The index and coordinates of the nearest edge on that face.

This pull request also includes:

Furthermore, I added a new reference page about the algorithm with a lot of images explaning how it works.

Closing remarks

  • We know this is not the best solution, but it is a very easy one.
  • All the things which I think could be improved are listed in the wiki
  • This algorithm is easy to parallelize.
  • The biggest challenge is that our sollution must account for arbitrary numbers of octrees with variable position, rotation and scale. This is far more complicated than simple octree traversal as we know it from cube-engine.

@IAmNotHanni IAmNotHanni self-assigned this Jan 17, 2021
@IAmNotHanni IAmNotHanni added the cat:enhancement enhancement/requested feature/update of existing features label Jan 17, 2021
@IAmNotHanni IAmNotHanni added this to In progress in Octree-editor via automation Jan 17, 2021
Copy link
Collaborator

@movabo movabo left a comment

Choose a reason for hiding this comment

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

(OUTDATED)
Good work! :)
I only found some trifles.

Disclaimer: Did not test the code and did not check the algorithms for (conceptual) correctness.

include/inexor/vulkan-renderer/world/collision.hpp Outdated Show resolved Hide resolved
include/inexor/vulkan-renderer/world/collision.hpp Outdated Show resolved Hide resolved
include/inexor/vulkan-renderer/world/collision.hpp Outdated Show resolved Hide resolved
src/vulkan-renderer/world/collision.cpp Outdated Show resolved Hide resolved
src/vulkan-renderer/world/collision.cpp Outdated Show resolved Hide resolved
@IAmNotHanni

This comment has been minimized.

@IceflowRE IceflowRE added diff:advanced advanced skills required feat:octree octree, cube computations org:in progress somebody is working on this labels Mar 26, 2021
@IAmNotHanni IAmNotHanni changed the title Octree collision Octree collision detection Mar 28, 2021
@IAmNotHanni

This comment has been minimized.

@IAmNotHanni

This comment has been minimized.

@IAmNotHanni IAmNotHanni force-pushed the hanni/octree_collision branch 2 times, most recently from 2b1faf8 to 9953b27 Compare April 18, 2021 02:47
@IAmNotHanni IAmNotHanni marked this pull request as ready for review April 18, 2021 02:48
@IAmNotHanni
Copy link
Member Author

Alright I'm done. Any more reviews?

@IAmNotHanni
Copy link
Member Author

IAmNotHanni commented May 7, 2021

  • Add edges to documentation.

@IceflowRE
Copy link
Member

One last request can you add the face id order here

@IAmNotHanni
Copy link
Member Author

Sure, but once again I can't answer to your post directly for some technical reason.

@IAmNotHanni
Copy link
Member Author

IAmNotHanni commented May 20, 2021

Move BBOX_CORNERS_ON_FACE_INDICES to cube class code and rename it to CORNER_INDICES_ON_FACE.
This will be done in a separate pull request (see #386).

@IAmNotHanni
Copy link
Member Author

IAmNotHanni commented May 25, 2021

  • Squash before merge

@IAmNotHanni IAmNotHanni force-pushed the hanni/octree_collision branch 3 times, most recently from 6c07e1b to 734c221 Compare June 8, 2021 19:06
benchmarks/world/cube_collision.cpp Outdated Show resolved Hide resolved
include/inexor/vulkan-renderer/world/collision_query.hpp Outdated Show resolved Hide resolved
include/inexor/vulkan-renderer/world/collision_query.hpp Outdated Show resolved Hide resolved
src/vulkan-renderer/world/collision_query.cpp Outdated Show resolved Hide resolved
include/inexor/vulkan-renderer/world/collision.hpp Outdated Show resolved Hide resolved
@IAmNotHanni IAmNotHanni requested a review from movabo June 9, 2021 21:27
@IAmNotHanni IAmNotHanni dismissed movabo’s stale review June 9, 2021 21:28

This review is outdated.

@IAmNotHanni IAmNotHanni merged commit 99d1a5d into master Jun 9, 2021
Octree-editor automation moved this from In progress to Done Jun 9, 2021
@IAmNotHanni IAmNotHanni deleted the hanni/octree_collision branch June 11, 2021 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:enhancement enhancement/requested feature/update of existing features diff:advanced advanced skills required feat:octree octree, cube computations org:in progress somebody is working on this
Projects
Octree-editor
  
Done
Development

Successfully merging this pull request may close these issues.

Implement a fast ray-octree collision to find selected cubes, cube faces and cube edges.
5 participants