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

[Godot 4.0 Alpha 14] Area3D collision bodies behaves differently between BoxShape3D and Trimesh #64588

Open
Sch1nken opened this issue Aug 18, 2022 · 3 comments

Comments

@Sch1nken
Copy link
Contributor

Godot version

4.0 Alpha 14 Official

System information

Manjaro Linux, AMD Ryzen 4800H iGPU

Issue description

Texting an Area3D collision against a StaticBody3D+CollisionShape3D+BoxShape3d and a StaticBody3D+CollisionShape3D+Trimesh (From a Box with the same dimensions) has different collision detection results.
Mainly the Trimesh collision seems "broken". The collision is only detected while >50% of the Area3D is "outside" of the Trimesh.

Video: https://user-images.githubusercontent.com/11414422/185504961-e183801c-b94e-4be1-90f4-2ece1f696a09.mp4

Controls for the demo:
"ui_left" (Left Arrow): Move box to the left
"ui_right" (Right Arrow): Move box to the right
"ui_select" (Space): Align camera (due to perspective etc)

Steps to reproduce

Create a Trimesh Collision Sibling from a Mesh (here: from a glb).

Minimal reproduction project

collisiontest3d.zip

@CristianoSimao
Copy link
Contributor

Yes. Trimesh have problems, see here: #64615

@rburing
Copy link
Member

rburing commented Aug 23, 2022

To detect collisions with the trimesh surface from both sides, you can enable the backface_collision property of the ConcavePolygonShape3D. This makes the Area3D work in the sense that it detects collisions with the surface.

It is true that the ConcavePolygonShape3D does not support detecting collisions with the "inside" of the shape, because in general the shape is just a collection of triangle faces, with no natural notion of what is the "inside". This is made clearer in the 2D editor, where the ConcavePolygonShape2D is visually just a collection of line segments, which is not filled in.

In contrast, convex shapes have a natural inside; ConvexPolygonShape2D and ConvexPolygonShape3D (and most other specialized shapes) do support detecting collisions with the inside.

This definitely needs to be documented, and perhaps a configuration warning should be added to Area2D and Area3D, since this behavior of concave shapes is more likely to be confusing than to have an actual use case.

@CristianoSimao
Copy link
Contributor

Thank you for the explanation Ricardo. And thanks for the phrase " This definitely needs to be documented ". Various vital information and features are not documented or have some simple lines of description not showing the behavior of the functions in the API, and this makes it difficult for new users like me and many other people uses Godot. Some great information are in the Tutorial category and If you are searching some official description of the function in the API, Tutorial is not the first place to search... and the search bar inside the documentation not find good results, searching in Google is some times the only way to find information in the Godot documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants