Bullet: Bumpy RigidBody to static trimesh collisions #21341
Comments
|
Can you try to split all parts, and make a smaller one to avoid precision error? Also when you have this kind of trimesh shape you have to increase the physics frames from 60 to 240 or so to make it more stable |
|
Splitting all parts will just make the object pop into the air upon crossing the seams, even with primitives like cubes (I've observed this in my own game). I also shouldn't need to increase the physics framerate to resolve this - the physics engine should simply make crossing over the individual triangles smooth. Not to mention, increasing it to 240 doesn't completely solve the issue, it just makes it less severe. It seems to be an issue with edge filtering. A few pages related to the issue elsewhere: |
|
Yes, you need to use the There is a very old demo that show how to use it: |
|
@erwincoumans There is a bug in the btAdjustInternalEdgeContacts. Here the implementation: The bug is that I use a compound shape and the function take the compound shape and cast it to a trimesh. |
|
I added a check for the expected mesh type before casting. |
|
I can't avoid use a compound due to Godot requirements, but I can write a patch to support that case |
|
Why is it a requirement? Do you need a transform or is it required to have multiple shapes? We could add a btTransformShape (better performance as btCompoundShape). |
|
It's required to have multiple shapes, I could use the btTransformShape
when only one shape is used but support compound is necessary anyway
…On Fri, Aug 31, 2018, 21:18 erwincoumans ***@***.***> wrote:
Why is it a requirement? Do you need a transform or is it required to have
multiple shapes? We could add a btTransformShape (better performance as
btCompoundShape).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21341 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH9MR8V9M7g8oxcEsqyA1CBrqJg5QV9iks5uWYvwgaJpZM4WKpud>
.
|
|
Some more background, at least from a Godot user perspective: In Godot, objects are placed within a scene tree. For a physics object, you create a RigidBody or StaticBody (or similar) object. These objects do not contain shapes by themselves. Instead, you add one or more CollisionShape objects as children. These shapes are used together to form the compound shape. This means it's possible to do something like have a trimesh shape and a cube shape be part of the same object. It's not exactly ideal from the perspective of Bullet, but it is something that the user can do. An easy fix would probably be to show a warning in the tree when a user has multiple CollisionShapes with one being a trimesh shape, since we already show a warning when there are no CollisionShapes. But if the Godot project wants to keep options open, the fix should probably be within Bullet, assuming there are no major performance concerns. |
|
@erwincoumans I've created the function This function is called with colObj1Wrap that wrap When I create a trimesh shape I use |
|
This is expected: during the dispatch, there will be temporary collision shapes generated (btTriangleShape) that get passed to the narrowphase and contact callbacks. You can still access the original collision shape, if you want to do filtering. The btCollisionObjectWrapper colObj1Wrap->m_shape may point to btTriangleShape, Can you double-check? |
|
oh ok, so can you please confirm that this function is called 1 time (for each step) per body even if it has more then 1 shape? (I want to avoid multiples useless update) Thanks you! |
|
So after checking better the function I saw that is not possible to fetch compound and send just the single shape from outside, so I changed the Bullet function (You can find it below): The problem is that the generated hash: |
|
The function is called for each contact point separately, to correct its normal. It is a bad choice to always force shapes to be wrapped in a btCompoundShape, even for a single collision shape that doesn't have any transform offset etc. |
|
Ok I can optimize that case |
|
Optimized following the advice of erwin, and also implemented the use of function: btAdjustInternalEdgeContacts but doesn't solve the problem #21808 |
|
would be interesting test it inside PyBullet... can you please give me the blender file of this shape? |
|
Did you generate the internal edge information?
Do you have the trimesh as an .obj file? If so, it is easy to reproduce inside PyBullet. We use the internal edge utility as option in PyBullet.
…On Thu, 6 Sep 2018 at 09:51, Andrea Catania ***@***.***> wrote:
would be interesting test it inside PyBullet...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21341 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAsR3Lbt8Hr2Em_Fj5o-EupJcGouSnayks5uYVKlgaJpZM4WKpud>
.
|
|
Yes I do it. Could be due by the fact that I use btTriangleMesh to generate btBvhTriangleMeshShape? @cosmicchipsocket Do you have the blender file of this trimesh shape? |
|
@erwincoumans I know that you don't have time to support us but I really don't know why this happen.. Do you know if margin could introduce this behaviour? also increasing timestep from 60 to 120 make the problem completely disappear. |
|
I've checked if the problem was introduced by #e5bfa98d0fa6a1acb1d385534c51b8006ef64142, but that PR just increased that problem... |
|
Change margin of trimesh shape to 0 seems to reduce drastically this problem, but I'm wandering if the normal (so the order of vertices in the triangle) is a significant information for bullet... Could be that the margin is applied toward the triangle face direction? |
|
I was hoping that #21808 would fix the issue but now it seems to have gotten worse. Nine times out of ten I can't even make it to the half-pipe without being flung off to the side. |
|
Here's the Blender file |
|
This fix your issue: #22759 Let me know and thanks you for your report! |
|
That's awesome @AndreaCatania - when would we want |
|
When you don't need to walk on a trimesh, or if you don't have any problem walking on it with that parameter set to false. |
|
It's not 100% solved but much improved. Half-pipe feels right but the puck still catches on a couple triangle edges in the first part. Setting physics FPS to 120 mostly eliminates these issues. |
|
I'm glad to see this clip, and also thanks you
…On Sun, Oct 7, 2018, 19:35 Cosmic Chip Socket ***@***.***> wrote:
Wanted to share this clip. Thank you for your hard work improving the
physics.
[image: quarterpipecropped]
<https://user-images.githubusercontent.com/34800072/46584795-cca14a80-ca35-11e8-9651-dad6a69f4938.gif>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21341 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH9MR5hYimDrTdF7khhjPWEapjHGRaooks5uijt3gaJpZM4WKpud>
.
|
|
Can we document |
|
Imagine a triangle mesh with two big triangles. Your object (a box) is on a triangle - sliding toward the other triangle. When it touch the edge of the other triangle it generates a normal that doesn't follows the surface The Note that, to fully use this feature, also the trimeshshape COM must be 0,0,0. |
|
I think I am running into the same problem here, in 3.2.stable from Ubuntu 20.04. I have enabled |
|
If that still the case, try to open a new issue with a sample project. |
Very nice! Where do I find the page |
That Pull Request has not been merged yet, so it's not yet in the online documentation. |
|
I am starting to see this exact issue pop up again in Godot v3.2.3. I am trying to use a rigid body with a sphere collision, and a concave polygon tri-mesh collision for a racing game, but every time the sphere car controller hits an edge in the collision, it just keeps jumping up. It's very similar to both @jes and @cosmicchipsocket video. I've tried both Bullet and GodotPhysics with the smooth_trimesh_collision option selected, and the collision margins dropped to .001 with no success so far. 2021-02-22_02-07-34_Trim.mp4 |
|
I seem to recall that my problem was at least partly down to having a really low mass for the vehicle. What's your vehicle mass set to? You might find the problem gets better if you increase it by 10x or 100x. |
|
It's set to a mass of 1500, which I feel like should be more than high enough, if not too high. I've tried setting it higher and it only slightly helps, but is still very prominent unfortunately. |
|
I'm thinking that the smooth_trimesh_collision may have just been a temporary solution, and something in the 3.2.3 update caused it to break. It might be worth me trying out the project in an earlier version of Godot to see if it's still there. |
|
Hey ! Hope you're doing fine, i'm having the same issue that you got ( 5 years ago hahah ) I did this But in javascript so it looks like this : the thing is, i don't know where to set my callback, is it on the physicsworld.setContactProcessedCallback ?? I would love to talk with you and maybe you can share with me your experience and solutions for this! |

Godot version:
2db4942
OS/device including version:
Arch Linux (rolling release)
Issue description:
Collisions between basic Bullet primitives and trimesh collision shapes generated from an imported model cause sliding objects to pop into the air whenever they cross triangle boundaries. I would expect the object to slide smoothly over the mesh. Until this is fixed I can't really work on my game any further.
(This GIF shows the puck falling through the floor. I know this is already covered by #20408, but I am experiencing problems beyond that issue's scope)
I tried changing the margin on both the puck and the trimesh, but this only made problems worse.
Steps to reproduce:
Download example project, hold Space for a bit, then release
Minimal reproduction project:
bumpy_trimesh_collision.zip
The text was updated successfully, but these errors were encountered: