Merge pull request #91731 from TokageItLab/b2s

Fix Bone2D gizmo scaling
This commit is contained in:
Rémi Verschelde 2024-08-19 16:04:40 +02:00
commit ea054261e2
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 1 additions and 3 deletions

View File

@ -326,9 +326,7 @@ bool Bone2D::_editor_get_bone_shape(Vector<Vector2> *p_shape, Vector<Vector2> *p
rel = (p_other_bone->get_global_position() - get_global_position()); rel = (p_other_bone->get_global_position() - get_global_position());
rel = rel.rotated(-get_global_rotation()); // Undo Bone2D node's rotation so its drawn correctly regardless of the node's rotation rel = rel.rotated(-get_global_rotation()); // Undo Bone2D node's rotation so its drawn correctly regardless of the node's rotation
} else { } else {
real_t angle_to_use = get_rotation() + bone_angle; rel = Vector2(Math::cos(bone_angle), Math::sin(bone_angle)) * length * get_global_scale();
rel = Vector2(cos(angle_to_use), sin(angle_to_use)) * (length * MIN(get_global_scale().x, get_global_scale().y));
rel = rel.rotated(-get_rotation()); // Undo Bone2D node's rotation so its drawn correctly regardless of the node's rotation
} }
Vector2 relt = rel.rotated(Math_PI * 0.5).normalized() * bone_width; Vector2 relt = rel.rotated(Math_PI * 0.5).normalized() * bone_width;