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

RigidBody2D PhysicsMaterials not applied if collision_mask or collision_layer is changed #291

Open
TrevorPeyton opened this issue Oct 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@TrevorPeyton
Copy link

Describe the bug

PhysicsMaterials applied to bodies through the physics_material_override are not applied if they are created before assigning a collision_mask or collision_layer. They work properly if they are defined after setting collision_mask or collision_layer.

To Reproduce

Define the physics_material_override in code like such:

physics_material_override = PhysicsMaterial.new()
physics_material_override.bounce = 0.0
physics_material_override.friction = 1.0

then set the collision_mask or collision_layer property to anything:

collision_layer = 1
collision_mask = 1

and the materials are now ignored.

Expected behavior

Regardless of when the PhysicsMaterial is defined in code, the body should reflect it. If collision_layer or collision_mask is updated it shouldn't have any bearing on the material.

Environment:

  • OS: Mac
  • Version: v0.8.8
  • Godot Version: 4.3
  • 2d (fast and slow)

Example project(zip)

physicsmaterialissue.zip

@TrevorPeyton TrevorPeyton added the bug Something isn't working label Oct 25, 2024
@TrevorPeyton TrevorPeyton changed the title PhysicsMaterials are not applied PhysicsMaterials not applied if collision_mask is changed Oct 25, 2024
@TrevorPeyton TrevorPeyton changed the title PhysicsMaterials not applied if collision_mask is changed PhysicsMaterials not applied if collision_mask or collision_layer is changed Oct 25, 2024
@TrevorPeyton TrevorPeyton changed the title PhysicsMaterials not applied if collision_mask or collision_layer is changed RigidBody2D PhysicsMaterials not applied if collision_mask or collision_layer is changed Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant