Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

feat: introduce RigidBodyDominance component #233

Closed
wants to merge 2 commits into from

Conversation

agg23
Copy link
Contributor

@agg23 agg23 commented Apr 6, 2022

Rapier3d supports a dominance property (dimforge/rapier#122) that is used in collisions between two dynamic RigidBodys. If one body's dominance is higher than the other, that body will not experience any forces in the collision, acting as if it has infinite mass.

This PR adds a small RigidBodyDominance component to support setting this property. In particular, this helps address #96, allowing your player body to ignore forces exerted by other dynamic bodies colliding with it.

@agg23 agg23 changed the title Introduce RigidBodyDominance component feat: Introduce RigidBodyDominance component Apr 6, 2022
@agg23 agg23 changed the title feat: Introduce RigidBodyDominance component feat: introduce RigidBodyDominance component Apr 6, 2022
@agg23
Copy link
Contributor Author

agg23 commented Apr 6, 2022

I could see this turning into a RigidBodyConfig component, rather than having unique components for each config option.

@jcornaz jcornaz self-requested a review April 14, 2022 07:17
@jcornaz jcornaz self-assigned this Apr 14, 2022
Copy link
Owner

@jcornaz jcornaz 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 your contribution. I will definitely appreciate this feature.

Would it be possible to add a test?

Comment on lines +352 to +356
#[derive(Debug, Component, Copy, Clone, Default, Reflect)]
pub struct RigidBodyDominance {
/// The dominance of the rigid body. The higher value in a collision will dominate
pub dominance: i8,
}
Copy link
Owner

Choose a reason for hiding this comment

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

I think here I would prefer to have the field private and implement From<i8> for RigidBodyDominance and From<RigidBodyDominance> for i8.

So that we promise a little bit less, and keep the door open to change the internal representation.

@jcornaz jcornaz added the enhancement New feature or improvement label May 19, 2022
@jcornaz jcornaz changed the base branch from main to alpha July 12, 2022 16:06
@jcornaz jcornaz changed the base branch from alpha to main August 16, 2022 11:02
@jcornaz
Copy link
Owner

jcornaz commented Nov 12, 2022

Heron is now discontinued. Sorry this change never got merged.

Thank you for your interest in the project and your contributions.

@jcornaz jcornaz closed this Nov 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants