Saitodepaula Posted November 18, 2022 Share Posted November 18, 2022 (edited) A fast rotating/rolling rigid body (sphere or cylinder) over a flat terrain bumps when moving. I've used a default LandscapeLayerMap, and have not edited it's shape, only size and position. I've added a C# component to the sphere/cylinder adding torque in one axis every frame at the UpdatePhysics() function. CS file is attached. My guess is that the terrain, even a flat one, uses a concave collision shape, and the rotating bodies bumps at the edges of internal triangles of the collision shape. I have this guess because the behaviour is the same over the default ground plane. But, if I add a BODY of type RIGID to the ground plane, set it to IMMOVABLE, and add a BOX as collision shape (a convex collision shape), the sphere or cylinder rotates smoothly, with no problems. I also have this guess because I've found the same bug in Godot Game Engine, which uses a port of Bullet physics engine: https://github.com/godotengine/godot/issues/50463 I've tested changing the following parameters in the SETTINGS > PHYSICS (each of one alone or combined), with no difference: Stable FPS Determinism Sync Engine Update Update Mode Budget Iterations Context of why I am testing this type of behaviour: I have a physics based, arcade like, racing game made with Godot, that does not use a raycast model. Instead, I've made a custom solution with joints attaching rigid body wheels to a rigid body vehicle body. The motors of the joints add torque to the wheels, making the vehicle move. But due to the bug described, I can't expand the game to large terrains. I'm experimenting with Unigine to port my game to Unigine, because the physics in general looks rock solid. I'll continue my tests, but have already found this problem. Additional comments: I can attach the SOURCE and DATA folder from my project. I have not done it already because these two folder together are 500 MB in size, and I don't know if it's worthy it. The cylinder begans to make weird movements after the first bumps. I guess that's because the ObjectBodyRigid.AddTorque() function adds torque to the global/world axis. But the effect is only visible because of the first bumps, caused by the terrain. In the sphere video, the PERSECUTOR camera has some random movements. But they only happen when recording the video (I use Movavi). When not recording, the camera follows the sphere smoothly with no random movements. UnigineRollingBall.mp4 UnigineRollingCylinder.mp4 Ball.cs Edited November 21, 2022 by Saitodepaula 1 Link to comment
silent Posted November 21, 2022 Share Posted November 21, 2022 Saitodepaula Thank you for the detailed description and test scene with videos. We indeed faced this issue couple of time before, but didn't have much time for resolving it yet. That's why we still do recommend to use basic ray-cast JointWheels for more stable behavior (but apparently that would not work in your approach). Maybe replacing ShapeCylinder with autogenerated convex shape would result in a more stable physics behavior in your case, but that needs to be tested (last time we dig into it was long ago). For some project we often use multiple speheres for wheels shape approximation, works quite good in some cases (especially with bigger wheels). We do have couple of "usual suspect" in the physics code that might be responsible for that behavior and once we would have more time for internal physics refactoring we will surely take a closer look into this issue as well. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Saitodepaula Posted November 21, 2022 Author Share Posted November 21, 2022 (edited) Thanks again @silent! I've updated the first post with some more info: Quote I've tested changing the following parameters in the SETTINGS > PHYSICS (each of one alone or combined), with no difference: Stable FPS Determinism Sync Engine Update Update Mode Budget Iterations But, I could not change the physics FPS, even when changing the BUDGET to higher values. In another project, the max value I could change for the physics FPS is 120. So, two more questions: What parameter limits the physics FPS? Is there no way to have values like 240 or 480? Edited November 21, 2022 by Saitodepaula Link to comment
silent Posted November 22, 2022 Share Posted November 22, 2022 Increasing physics budget / FPS will not solve the initial issue with <Shape> <--> <Triangles> physics intersections, I'm afraid. You still would require a shape beneath the terrain / mesh for more stable contacts detection. Regarding the Physics FPS change - how do you change it? In init() inside WorldLogic you can do the following: Physics.IFps = 1.0f / target_fps; And that should be enough. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts