Skip to content

Fix body material defaulting some state#495

Merged
Ughuuu merged 1 commit intoappsinacup:mainfrom
Ardot66:fix_body_material
Mar 13, 2026
Merged

Fix body material defaulting some state#495
Ughuuu merged 1 commit intoappsinacup:mainfrom
Ardot66:fix_body_material

Conversation

@Ardot66
Copy link
Copy Markdown
Contributor

@Ardot66 Ardot66 commented Mar 13, 2026

Resolves #492
Resolves #488

This prevents RapierCollisionObjectBase from overwriting material properties that should only be set by RapierBody. Namely bounce and friction, but also contact skin and soft ccd.

I just threw this together because I realized it would be simple to fix this way, but if this seems too hacky I can set up a system where body_update_material takes two material parameters: a new BaseMaterial and the standard Material, where they each handle their respective collision object type, and the Material is optional to allow RapierCollisionObjectBase to modify things safely.

This prevents RapierCollisionObjectBase from overwriting material
properties that should only be set by RapierBody.
@Ughuuu
Copy link
Copy Markdown
Contributor

Ughuuu commented Mar 13, 2026

Kinda beats the purpose of the material. Not a big fan of this, but if it works I guess it's ok. I would rather either have 2 functions, and not have the bool param, or not have the material and instead have optional parameters, or just construct the material correctly.
Anyway, have you tested locally to see if it works? About the 3d thing failing, that was a mistake from me, will fix it in a later PR.

EDIT:
Oh, I see, base as in ObjectBase. Ok, then I think the naming is ok. My bad, read it quickly and didn't realise. It's not as bad as I initially thought.

@Ardot66
Copy link
Copy Markdown
Contributor Author

Ardot66 commented Mar 13, 2026

I tested locally and it worked as expected, at least for bounce. As for splitting it into two functions, I could set that up later if you want to hold off on merging.

@Ughuuu Ughuuu merged commit 24ce049 into appsinacup:main Mar 13, 2026
75 of 76 checks passed
@Ughuuu
Copy link
Copy Markdown
Contributor

Ughuuu commented Mar 13, 2026

Nah, it's ok like this. You can if you want as a future PR, though it's not bad as it is right now. Thanks for contributing!

dog-molecule pushed a commit to dog-molecule/godot-rapier-physics that referenced this pull request Mar 26, 2026
Resolves appsinacup#492
Resolves appsinacup#488

This prevents RapierCollisionObjectBase from overwriting material
properties that should only be set by RapierBody. Namely bounce and
friction, but also contact skin and soft ccd.

I just threw this together because I realized it would be simple to fix
this way, but if this seems too hacky I can set up a system where
`body_update_material` takes two material parameters: a new
`BaseMaterial` and the standard `Material`, where they each handle their
respective collision object type, and the `Material` is optional to
allow `RapierCollisionObjectBase` to modify things safely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing bounce and friction does not do anything Area3D changes Rigidbody3D's physics behavior after setting a collision mask layer on it

2 participants