Bone Attachment 3D cannot contain any collision purpose objects in it
Tested versions
v4.4.1.stable.official [49a5bc7b6]
System information
Windows 10, Jolt Physics, Rendering Driver: Vulkan, Rendering Method: Mobile
Issue description
Due to some reason all bones in a rig take random scales, instead of being (1, 1, 1) as they should in order to avoid issus like one listed below, they have slightly altered values of scale, such as (0.984, 1.023, 1.104) And due to this u cannot parent stuff like Area3D as child of BoneAttachment3D because godot will complain on that it being not uniformly scaled and thus push an error into the console every tick, and so it accumulates around few thousands of those what leads to memory leaks and crashes upon trying to clean those.
Down here my description on how i discovered this issue a few days ago:
So for unknown reason, the BoneAttachment3D took a random non-uniform scale and refuse to accept anything else, on what godot complains as u can see in the console.
As demonstrated, this isnt a systematic error since only some of the BoneAttachment3d's have this corruption. Parent in which they lay is scaled to (100, 100, 100) and this particular BoneAttachment Scaled to (1,016, 0.968, 1.1016). If i scale HitBoxParent to 1,1,1 issue wont dissapar as now scale of BoneAttachment will be same but multiplied by 100 and issue will remain. Reason why the boneAttachments were scalen up so humongously is that apperantly its automatic upon bounding to an external skeleton. Going up the whole hierarachy, non of the parents is scaled non uniformly, but (1, 1, 1)
I tried taking those BoneAttachments which were corrupted and instead of using an external skeleton on them - move them into the skeleton it self and i finaly was able to tweak the scale of those BoneAttachments, But as i started game, animation of skeleton played, and the EXACT same error pouped up, i mean the engine still was percieving the scale as (100.037125, 100.037125, 100.037125) It is because of the "rig" object's scale is (100, 100, 100) - that is the specifics of Blender to Godot export so the Rig scale was not my decidion. Blender i exported the models from: some version around 3. Now im using the 4, but at the moment when the Player Model was done it was assumingly the rouhgly last one. Ill try re-exporting the model from the currently last version of blender. The current Player Model format is FBX.
Another issue is that Godot prints an exorbitant amount of errors, to that degree that it CRASHES or freezes up to a straight minute.
The thing is i tried avoiding this issue by utilizing the RemoteTransform3D, giving its remote path a boneAttachment3D i need and just pick it not to copy scale. But no. It just doesnt work. It stands still like if nothing would happen even through the bone is moving around.
Important to note: Despite of all of this errors which seemingly point to that these collider things should not work, everything works fine, and all of the collider seem not to change enough for like... like i mean maybe they scale a tiny but differntly but thats so insignificant that in game its not noticible and if not errors i wouldnt ever know. Im using Jolt Physics since its actually much better then the standart one, thats a whole another subject to disscuss. I hope i included enough information for issu to be solven but if i didnt please tell me which clues should i add, i plan to report this as a bug to Godot Github.
So apperantly im not the only person who struggles wtih such an issue and i believe thats a bug. Heres a link
I appologise profuselly for inconviniences brought by how poorly i have composed this report, im just really exhausted with this issue but couldnt just keep it for my self since theres litterally only a single mention of it ever created only on reddit which were left with no attention.
Steps to reproduce
-
using Jolt physics export any armature with more then just a few bones, a humanoid rig for instance.
-
Make a BoneAttachment3D (it doesnt matter if it utilizes externall skeleton or is a child of one)
-
Parent an Area3D to it with a CollisionShape3D into it (shape doesnt matter)
-
Move the bones in any way during run time or in editor, with animation or IK nodes
-
Foremention issue will appear at this moment
Minimal reproduction project (MRP)
I must as well notice that the same errors arent getting pushed when non Jolt physics is being utilized
I'm getting this issue in a project that I'm working on, #107986 sounds similar but after going through the entire hierarchy of our skeletons I was unable to find a single scale value that had been changed.
This bug causes the debug log to get spammed with these "_try_build_shape" errors. Resulting in performance hitches and in rare cases, crashes caused by the engine spamming errors to the debug log.
I saw that reddit post experiencing the same issue, that OP stated that changing their CollisionShapes from Spheres to Boxes fixed it, however I was unable to get that workaround to work in my case.
We have not changed any of the scales on our model or skeleton, everything is set to the default. It looks like the scale gets modified in the editor too. The values do not change, however the reset values button appears and clicking on it causes it to disappear before immediately reappearing:
https://github.com/user-attachments/assets/ced40b5b-ebe1-4e1a-9552-4398feb9bcc7
Another note, looking at the actual bone values inside the Skeleton3D shows that the scale is not being affected at all? I'm not entirely sure but you can see that he reset values button does not appear when viewing the actual bone that the BoneAttachment3D is parented to:
https://github.com/user-attachments/assets/c2e9cda0-5307-48b3-ac84-3a7472a3eec1
I would assume that this bug is specific to BoneAttachment3D based on what I've found so far.
I'm running this on Pop_OS 24.04, however this happens on Windows 10 and Windows 11 systems as well.
This happens in 4.4, 4.4.1, 4.5 devs 1-5, and 4.5 betas 1-4.
@laviphon Out of curiosity, what happens if you attach this script to all the relevant BoneAttachment3D?
@tool
extends BoneAttachment3D
func _init() -> void:
set_disable_scale(true)
@mihe I went and threw that onto every BoneAttachment3D and I no longer get any "_try_build_shape" errors.
I have run into this in the past and painstakingly removed all scaling from my animations only to find out that the LookAtModifier3D and probably other SkeletonModifiers scale the respective bones, giving me a whole slew of Jolt Physics errors. I think the option to lock scale the same way we can lock rotation in editor would be nice, or the ability to ignore this error, since my position is that a floating precision issue should just be rounded away instead of constantly throw an error, it's expected behavior if you interpolate such small values.
I think the option to lock scale the same way we can lock rotation in editor would be nice
Yeah, I've also been thinking that this might just be low-hanging fruit in terms of fixes to some of these cases, by exposing the Node3D.set_disable_scale method as a property instead, that can then more easily be toggled. The vast majority of people I've talked to that have run into this (not just because of BoneAttachment3D) don't want scaling to happen to begin with.
my position is that a floating precision issue should just be rounded away instead of constantly throw an error, it's expected behavior if you interpolate such small values
For what it's worth, that is my position as well, and that is exactly what happens already, but only up to a point. Jolt offers the ability to correct any invalid scaling, so we use that to always correct the scaling, and then we compare that against the actual scaling. If the difference on any axis is greater than some set amount, which is currently set to 1% (here), then we show this error.
That might not sound like much, but given that your visual representation of the object (e.g. mesh, debug drawing, whatever) won't also be corrected, having it deviate from what's actually happening in the physics simulation by even that much will no doubt leave some people scratching their heads.
Can confirm this issue still exists on:
Godot v4.6.dev (25203e24c) - Windows 11 (build 26100) - Multi-window, 2 monitors - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 4080 SUPER (NVIDIA; 32.0.15.8180) - AMD Ryzen 7 7800X3D 8-Core Processor (16 threads) - 63.11 GiB memory
I was able to change the scale of the BoneAttachment3D parent of the Area3D in the MRP and when the scale on each axis is equal there were no errors, otherwise an error is printed on every change to the scale. But when starting the scene the error was still raised (with the original values) and when restarting the project the scale is reset to its original values.