-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Bone2D scaling #91731
base: master
Are you sure you want to change the base?
Fix Bone2D scaling #91731
Conversation
I think the problem was that the gizmo scaling was scaling after the rotation. So, perhaps the scaling of Node is done before the rotation? I think that is where the direction mismatch was occurring. Also, the abs() was needed in #81048 because there was a reverse rotation there to cancel first rotation (it was done rotation->scaling->rotation.inv). So now I make to simplify the calculations for the deformation so that they match the Node scaling. @thiagola92 Does this change make sense to you? |
Co-authored-by: Thiago Lages de Alencar <thiagola92@gmail.com>
I tested and it seems to be working 👍 I'm still confuse about how the rotation was affecting everything. real_t angle_to_use = get_rotation() + bone_angle;
//
rel = rel.rotated(-get_rotation()); But if I'm understanding correctly, there were some scale operation during this step... I'm understanding correctly? |
Note: This would fix Bone2D length when scaling To fix height too would probably need something like #81544 (which I used |
In the old code, the vector after rotation (Bone Angle + rotation) was globally scaled. This code globally scales the vector after rotation by Bone Angle only. Evenually, Bone Angle is a Bone2D property, so it should be handled by Bone2D, but rotation is a Node2D property, so transformation/scaling for rotation should be handled by Node2D. |
Co-authored-by: Thiago Lages de Alencar thiagola92@gmail.com @thiagola92
To minimize the effect of the fix; Context: #81048 (comment)Revised overall behavior.