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

Fix floor snapping for CSG shapes with collision #89833

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

Conversation

stevenjt
Copy link
Contributor

@stevenjt stevenjt commented Mar 23, 2024

This fixes #89832

I found that the cause of this behaviour was that the CSG Shapes with collision enabled were not being included in the exclude list for the raycast that finds the object/floor underneath being placed. This is because they do not use PhysicsBody3D but instead use PhysicsServer3D directly. At certain sizes, specifically small sizes, the raycast can then hit the object that is meant to be being placed causing it to be pushed up.

To fix this I have done the following:

  • Add get_collision_rid function to CSGShape3D.
  • Add additional checks when gathering nodes to exclude from raycast made when using the Snap Object to Floor feature of the 3D editor so that it finds and includes CSGShape3Ds that have collision enabled.

@stevenjt stevenjt requested review from a team as code owners March 23, 2024 23:47
@stevenjt stevenjt force-pushed the fix-snap-floor-csg-collision branch from 75bdad2 to ffea06f Compare March 24, 2024 00:09
@Chaosus Chaosus added this to the 4.3 milestone Mar 24, 2024
@fire
Copy link
Member

fire commented Mar 24, 2024

I think this is right but can't code review for the next few days.

@stevenjt stevenjt force-pushed the fix-snap-floor-csg-collision branch from ffea06f to 27ceb35 Compare March 24, 2024 16:19
@stevenjt
Copy link
Contributor Author

After having another look at this I've added the method binding + doc description so this new CSGShape3D function is accessible from the scripting interface, just as get_rid is for CollisionObject3D derived classes.

Add get_collision_rid function to CSGShape3D.

Add additional checks when gathering nodes to exclude from raycast made
when using the Snap Object to Floor feature of the 3D editor so that it
finds and includes CSGShape3Ds that have collision enabled.
@stevenjt stevenjt force-pushed the fix-snap-floor-csg-collision branch from 27ceb35 to cad6e68 Compare March 24, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snap Object to Floor does not work properly with small CSG shapes that have collision enabled
3 participants