I’ve got a scene inheriting from a GLTF that I’ve added an AnimationTree to to add animation blending, and I’ve also added a BoneAttachment3D to put a cup in my NPCs’ hands. The animation has them lifting the cup to their faces and setting it back on the table (without unparenting it from the BoneAttachment3D) but towards the middle of the animation, when the up is almost at face level, the cup disappears then reappears when they set it back down.
This doesn’t happen when I preview the animation in the editor, only when I test the game with full animation blending, so my only guess is that the problem has something to do with that, but I’m having trouble testing that in the editor because the animation ends before I can travel to another one to test if the problem is related to animation blending. I’m also guessing it’s not becoming invisible, but rather flying off camera so fast that it’s gone in a single frame. I’m using occlusion culling, but don’t have an occluder instance for the cup or the NPC, so I doubt that’s related.
I just tried that and found that I was wrong about that. It also doesn’t seem to be that something’s changing the visible property or the visibility mask of the cup mesh, as I tried setting those in _process and got the same behavior. However, running a smaller scene with the NPCs by itself rather than instanced in a larger scene with multiple cameras looking at different visibility layers doesn’t reproduce the behavior.
Next question: Are you monitoring your RAM and video RAM? Is it possible you are somehow running out and the cup is getting overwritten until the animation comes back to rest?
Only 193MB of VRAM used at peak. However, I just discovered that when occlusion culling is turned off in the project settings, the cup doesn’t disappear! Still not sure how to fix the issue without doing that, but I’m definitely onto something.
Update: after some reading, it looks like the issue was related to frustum culling. Adjusting the cup mesh’s extra cull margin fixed the issue. I’ll have to experiment to make sure I’ve increased the margin by enough to keep this from happening at different combinations of FOV, aspect ratio and camera angle, but I’ve gotten to the root of the problem!