I have recently started a new project in Godot 4.4.1 with a friend.
When modifying a cell of a GridMap at runtime, my camera shakes and I don’t know why.
I have confirmed that it doesn’t come from the Phantom Camera addon as I find the same issue with just a Camera3D and my GridMap on my scene.
And weirdly enough, the Camera transform doesn’t change at all (tested through printing the camera transform in process). This mean something is going on with the rendering of the GridMap.
I tried changing the renderer from Compatibility to Forward+, but still get the same issue.
I don’t have any idea how to solve that issue. I’ve searched for days on the internet for an answer unsuccessfully. It seems I’m the only one having this issue. But it doesn’t come from my computer as it happens on 3 different computers, one with an NVIDIA card, one with an AMD and one with an integrated AMD.
I only have 2 tiles in my meshlib, both are cubes of different colors with a StaticBody3D containing a Trimesh collision automatically generated by Godot (Mesh > Create Collision Shape > Static Body Child + Trimesh
).
Here’s a video of the issue.
It doesn’t show, but I’m also generating tiles as I move, and the screen recording didn’t catch on the shaking happening while generating new tiles.
I would bet it’s to do with collision rather than rendering. Have you tried using a simpler BoxShape3D? trimesh is a very expensive and complex collision shape that is best used for never-changing geometry only when necissary.
Maybe removing this gridmap layer from your player’s Floor Layers could help, if during the change it’s detected as a moving platform.
At first i used those simple box shapes. But they where causing an error imprecision in the ray cast detection. And a Box will probably be converted in its triangles anyways down the line, so it shouldn’t make a difference.
In collision the BoxShape3D is not converted to triangles, “triangles” in collision are very slow, mathematical boxes, spheres, capsules etc are much faster and more accurate. Ignoring the raycast error for now, did using BoxShape3D fix the camera shake?
Maybe to improve the floor accuracy even more, try removing collision from the floor segments and subtituting it for a WorldBoundry shape in the main scene?
No the issue was happening even before i changed the BoxShape3D to Trimesh.
Tho using a world border as the ground wouldn’t be a bad idea in my game.
That doesn’t look to me like the camera is shaking, it looks like the geometry itself is moving. There’s a big seam that appears when it happens.
1 Like
I’ll change the name of the thread to that.