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 post processing #155

Merged
merged 12 commits into from
Sep 25, 2023
Merged

Conversation

datael
Copy link
Contributor

@datael datael commented Sep 17, 2023

Objective

Create a stage to allow filtering and changing collisions from user-defined systems.

This is the simplest part of #150: the Global Physics hooks via user systems only.

Solution

  • Adds SubstepSet::PostProcessCollisions, which is directly after SubstepSet::NarrowPhase
  • Adds PostProcessCollisionsSchedule, which is run in SubstepSet::PostProcessCollisions
  • Exposes retain from Collisions to allow direct modification of the set of collisions

Also includes a simple one-way-platform example.

@Jondolf Jondolf added C-Enhancement New feature or request C-Examples Improvements or additions to examples A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality labels Sep 17, 2023
@datael
Copy link
Contributor Author

datael commented Sep 17, 2023

In #156 @Jondolf said they were planning on exposing normal2. After normal2 is exposed, the one way platform example can be simplified, so returning to draft state pending #156 getting merged.

@datael datael marked this pull request as draft September 17, 2023 10:47
@Jondolf
Copy link
Owner

Jondolf commented Sep 23, 2023

#156 is now merged! It exposes normal2 for contacts as I mentioned. I can review this soon :)

A simplistic example of implementing one-way platforms via collision filtering as part of the narrow-phase collision post-processing step.
@datael datael marked this pull request as ready for review September 24, 2023 00:19
@datael
Copy link
Contributor Author

datael commented Sep 24, 2023

Ok, that sample is now updated to use normal2 where appropriate.
Thank you for adding that. Now that the normal doesn't need to be rotated, the one way platform example is a lot less math-heavy!

@Jondolf Jondolf self-requested a review September 24, 2023 13:28
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/plugins/setup.rs Outdated Show resolved Hide resolved
Copy link
Owner

@Jondolf Jondolf left a comment

Choose a reason for hiding this comment

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

I left quite a few comments, mostly just additional code comments or tweaks to language/naming and some of the values in the example.

The one-way platform example is excellent, and the system could probably be just dropped into most projects with very little changes. I'm happy to merge this once we've sorted out the things I mentioned in my review :)

datael and others added 2 commits September 25, 2023 16:46
Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
…2d example (#150)


This appears to bring them to a height such that the vertical distance between the ground and the top edge of the lowest platform is the same distance between the top edge of the lowest platform and the next.

Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
datael and others added 2 commits September 25, 2023 17:02
#150)

Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
datael and others added 2 commits September 25, 2023 17:31
Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
Change "edit" to "modify" to match the paragraph above.
Copy link
Owner

@Jondolf Jondolf left a comment

Choose a reason for hiding this comment

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

Looks good now, thanks!

@Jondolf Jondolf merged commit dea01ef into Jondolf:main Sep 25, 2023
3 checks passed
RJ pushed a commit to RJ/avian that referenced this pull request Sep 25, 2023
# Objective

Create a stage to allow filtering and changing collisions from user-defined systems.

This is the simplest part of Jondolf#150: the Global Physics hooks via user systems only.

## Solution

- Adds `SubstepSet::PostProcessCollisions`, which is directly after `SubstepSet::NarrowPhase`
- Adds `PostProcessCollisions` schedule, which is run in `SubstepSet::PostProcessCollisions`
- Exposes `retain` from `Collisions` to allow direct modification of the set of collisions

Also includes a simple one-way-platform example.

---------

Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality C-Enhancement New feature or request C-Examples Improvements or additions to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants