-
This an odd and very specific issue I have been having for quite a while. I am opting to open a discussion here, rather than opening a ticket because I have not been able to create a minimal reproduction. I have however, found that it is being caused (in my case) by an interaction between StaticBody3D and Generic6DOFJoints when a scene is loaded or reloaded. If I had to make a guess on why it is happening, is that the unique IDs or related state for the static bodies and joints are not freed after the nodes are reloaded. I assume that this would be replicable using any PhysicsBodies and PhysicsJoints. I have missiles attached to an airplane using Generic6DOFJoints. After the scene has been reloaded twice (using Here's a video of the problem: Here's a video of the same demo but using Godot Physics, no issue present: The way I produce this issue, I run my game, reload the scene twice, and when the airplane gains velocity, the missiles shift to a position ahead of themselves, proportional to their linear_velocity. Every time the game window is closed, and re-run, this issue is always exhibited on the 2nd reload of the scene. The specific missiles that exhibit the behavior is random, but the amount of missiles that exhibit behavior seems to be correlated to the amount of staticbodies used by the terrain system. I have found that this behavior is in some way caused by the terrain's staticbodies. If I disable the static bodies from being added to the scene, the behavior returns to normal. If I set the static body's process_mode to Node.PROCESS_MODE_DISABLED, behavior is normal. If I disable the static bodies collision shapes, the behavior remains. The terrain being used is something I have created, it is a separate plugin and in no way interfaces anywhere else in the project. It uses threads and compute shaders for terrain gen. There are about 400 static bodies generated by the terrain. These nodes are not serialized, and are generated during the first few seconds after the scene has been opened. This is the code used on the terrain chunks to add the static bodies:
Here is the node layout of the missiles: I have tried increasing Jolt's max bodies setting, but it had no effect. In my attempts to make a minimal reproduction project, I tried instancing hundreds/thousands of static bodies at runtime, but I was not able to recreate the issue. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Are those missiles (or their joints) set as |
Beta Was this translation helpful? Give feedback.
-
After doing more testing, and removing more and more unrelated features and code (not finished yet), I did manage to confirm one of my hunches. It seems that the missiles forget that they are descendants of the airplane. Haven't managed to track down what exactly has caused this in the first place. I do have another hunch that the issue could be caused by the "inherited scene" feature of Godot. |
Beta Was this translation helpful? Give feedback.
A
RigidBody3D
(which I'm assuming your missiles are?) should ideally never be a descendant of another moving node, at least not one that moves every frame, like your airplane. This will cause the missiles to have their transform set every frame, which will interfere with the physics simulation. This is a problem in Godot Physics as well as Godot Jolt, although the ill effects with Jolt are typically worse and more pronounced, and is possibly what's causing these weird issues with the missiles.I realize this may sound like a frustrating limitation, but that's where the
Node3D.top_level
property comes in handy, as you can have your desired scene structure and then right before the simulati…