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

[CollisionModel] New: added collision layer property #4219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

polyakovkrylo
Copy link

This PR introduces collision layers, a collision filtering algorithm similar to the one used in Unity's collsion pipeline. The overall idea is to omit collision detection for models that are in different layers. This way, each layer can be used for different functionality, e.g. cutting simulation.


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger
Copy link
Contributor

Hey! Can you explain how it is different from the group property? Thanks

@polyakovkrylo
Copy link
Author

Hi, @alxbilger! It works the opposite way the collision groups work. With collision groups, collision can only occur between the models' group sets do not overlap (no common groups). With the collision layers it' s the opposite -- collision can only occur if the models are in the same layer.

@hugtalbot hugtalbot added enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request pr: highlighted in next release Highlight this contribution in the notes of the upcoming release labels Oct 5, 2023
@@ -407,6 +407,9 @@ class SOFA_CORE_API CollisionModel : public virtual objectmodel::BaseObject
/// models included in a common group (i.e. sharing a common id)
Data< std::set<int> > group;

// No collision can occur between collision models in different layers
Data<int> layer;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Data<int> layer;
Data<int> d_layer;

Copy link
Contributor

Choose a reason for hiding this comment

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

It also needs to be initialized in the constructor

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to define more than one layer for a collision model?

@bakpaul
Copy link
Contributor

bakpaul commented Oct 11, 2023

Hi vlad, this PR has also been discussed during the dev meeting.
The conclusions are the same as for the #4226 : we need more context/example of use (for instance to see how you use it in your scenes or plugin).

We are also curious to know how you handle differences between this and the group mechanism : what happens if you are in the same time in the same group and in the same layer ? Are the two mechanism really necessary ?
It could be also possible to remplace the group mechanism by yours to have a more positive mechanism (same layer = collision instead of diffrent group = collision). But for this it would need to handle multiple layer by object.

And finally, again, some unit testing would be great if we manage to find a mechanism that suites every one.

@bakpaul bakpaul added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement About a possible enhancement pr: highlighted in next release Highlight this contribution in the notes of the upcoming release pr: status wip Development in the pull-request is still in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants