-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
3D rotating/spinning RigidBody bumpy collisions with Trimesh Static Body #50463
Comments
I've tested the minimal reproduction project on 3.4 using the new method from #50257, setting the And using Godot Physics, just to make sure. |
@pouleyKetchoupp Do you know what causes this to occur? We're using a custom build of the engine to solve a couple other issues and may try to fix this one. Hoping to find a starting point. |
@mustangchavez I haven't investigated, but it looks like rigid bodies are wrongly detecting collision with triangle edges at high speed, maybe because of slight overlaps. In Bullet, I'm not sure why it fails even when In Godot Physics, Apart from that, when it comes to Godot Physics there's also a general issue with rigid bodies overlapping too much with each other, and I wonder if they also overlap more than they should with static bodies. I'm going to check this issue in the coming weeks, so it would be worth checking again this kind of triangle mesh issue afterwards to see if there's any improvement. Hope it helps you get a starting point :) |
Yes, this issue is really annoying and should be fully solved with @Saitodepaula Is your Trimesh Body respecting that? |
@AndreaCatania , the static body and the collision shape are not rotated/transformed/scaled. And Collision Shape margin is at 0.001. |
@AndreaCatania and @pouleyKetchoupp Hey guys, I am yet another person who would like to see this issue resolved. I have only a surface level understanding of the Godot BulletPhysics implementation, but I wanted to help however I could. I put together another Godot 3.4 test project that might be useful in diagnosing the issue. https://github.com/broag/godot-bumpy-sphere I stuck with Bullet + Smooth Trimesh Collision to test because Godot Physics and just Bullet did not look promising, even though there were circumstances where Godot Physics caused less bumpy behavior. It looks to me like the Smooth Trimesh Collision is only providing stabilization for Here is a video showing bumpy behavior with some sane defaults I chose (with friction enabled): Here is a video showing no bumpy behavior with the same defaults however friction is 0.0: It seems like something about the rotation is causing the problem, could it be a changing contact point thing (I have no clue...)? I'd love to help solve this issue! I've looked through the commits for the implementation of Smooth Trimesh Collision, but its pretty far beyond my understanding at this point. Any suggestions for a better starting off point or things that can be done to help someone get to a resolution on this? Thanks! |
I've just tested this same minimal project on Godot 4.0 Alpha 1, and in the ball script, I've had the error
The entire script is just this:
|
My first thought is that |
It may be. The documentation is being updated. For example, For this example, the result is the same, but for a wheel of a vehicle it's not the same. So I hope Anyway, I've updated the first post with a video using Godot 4, using |
I noticed that there were definitely differences between Godot Physics and Bullet Physics as well. The default physics engine switched from Bullet to Godot Physics in Godot 4.0. It would be helpful to verify with physics engine you are using for the videos. Bullet w/ Trimesh? or Godot Physics by default? |
Godot 3.3: both engines, in the first video you can see I tested both. |
I just read that Bullet Physics will be supported by an official plugin for Godot 4.0 (no idea what the current status is), but honestly I'm happy to use any engine that fixes this problem. |
I doubt this will be done in time for 4.0. |
Has anyone found a workaround for this problem? I was starting to make more complicated test models for my map, and ran into the same problem. I've been working on this game for about two months, and feel like I've run into a dead end. The player character is a Rigid Body sphere which uses add_torque for movement. I'm running into this problem with both Bullet and Godot physics. Edit: If anyone was wondering, I'm trying to make a game similar to this: https://youtu.be/6vtTBc65ZVc EDIT 2: I found the smooth_trimesh_collision option inside Godot_v3.4.3-rc2_x11.64 I'm not sure why it wasn't in 3.4.2. Now when I open 3.4.2 the option shows up for this project (which is now bugged in other ways, fortunately I have a backup). It doesn't seem to help in either version of Godot, nor with either version of Godot Physics. EDIT 3: So, this problem can be reduced, at least for me by increasing the physics frames from 60 to 240. It's probably not an ideal solution, as this may reduce the number of devices that can play the game, but it seems to make the problem almost unnoticeable in my project. I've had the best luck here with Bullet Physics, as Godot Physics introduces a new problem where the ball will suddenly freeze in place, and I haven't had any success fixing that. |
I suspect I might be running into this bug re this q&a post I made: https://godotengine.org/qa/137705/rigidbody-get_contact_local_normal-jumps-passing-collision |
I have opened an issue very similar to your problem (I did test almost the same test you did): #36729. |
As mentioned in Shifty's Godot Character Movement Manifesto, the current workaround is to merge the adjacent colliders into a single convex collider shape:
|
@Calinou This should be documented in Godot docs themselves, not in 3rd party site |
This issue is still occurring on Godot 4.2 using a RigidBody3D with a sphere CollisionShape3D. Merging colliders is not a relevant workaround, because this also occurs on the internal edges of a single convex collision shape. I'd also like to add that it also happens on 'sliding', with linear velocity.
Godot_v4.2_9OwWuGnoGO.mp4Also occurs in Jolt (spinning): 2024-01-27.04-56-56.mp4 |
The latest version of Jolt merged Jan 20, 2024 has mitigated this problem: jrouwe/JoltPhysics#882 This was pulled into GodotJolt on Feb 2. 2024: With an internal edge removal setting added on Feb 12. 2024: This tweet by jrouwe talks about the fix: They link to a source which explains the improved algorithm here, that could potentially be implemented into the Godot physics engine? https://www.codercorner.com/blog/?p=1156 As of the current date, the fix in the Jolt physics engine is not available in the release version of Godot Jolt, so it has to be built from the Godot Jolt source. Instructions can be found here: https://github.com/godot-jolt/godot-jolt/blob/master/docs/building.md I confirmed this in my own project, and so far I have not experienced ghost collisions on internal edges. I hope this will be helpful to anyone passing by. |
I wanna add to this discussion what I ended up doing in the Godot Rapier plugin ghost collisions: The idea is from http://briansemrau.github.io/dealing-with-ghost-collisions/. If the movement direction interacts with something that completely opposes it and the intersection distance is small enough, I disregard that contact point and eliminate it. Right now this is tested just for 2D, but it's also for 3D, just need to test it. |
Godot version
3.3.2 stable official
System information
Windows 10, GLES 3 NVIDIA GeForce RTX 2060
Issue description
In 3D, when a
RigidBody
like a sphere or a cyllinder is rotating fast, it bumps and jumps at the triangle edges of a ConcavePolygonShape (generated from a 3D mesh), withCreate Trimesh Static Body
option. Even on a flat plane this behaviour can be observed.With
Bullet
, even withCollisionShape
margin set to 0.001, origin at 0,0,0 andSmooth Trimesh Collision
activated, it happens.With
Gogot Physics
, it also happens, but it's almost imperceptible (look at the ball shadow to see it in the video below).I know there is #46596 already open, but the author of that issue describes sliding RigidBody.
Also, in #21341, it looks like when Smooth Trimesh Collision was implemented, it targeted sliding bodies.
May be related to #36729?
Steps to reproduce
Minimal reproduction project
The first video show behaviour both on Bullet and Godot Physics (Godot 3.3.2).
The second video is an update (26/01/2022) with Godot 4.0 Alpha 1. In my opinion, this issue got worse in Godot 4 (considering the Godot Physics results in 3.3).
TrimeshCollision.zip
TrimeshCollision.mp4
TrimeshCollision_Godot4.mp4
The text was updated successfully, but these errors were encountered: