Scale after rotation

I’m implementing multiselection and I have an issue. I rotate group and after scale it. After I return objects from group to the scene, at this moment objects a little bit rotate. You can see it on video
Why they rotate?
You can see source code here -> source code

I think you are trying to squash your geometry in a way it can not. They don’t rotate, they just return to their original form.

They are not seems squished. You can try it here
select object with Ctrl to add to group

Here’s what i think is happening, when you remove them from selection the objects scale themselves along their local x-axis (which gets rotated as you rotate the object). Is there any way you are removing the objects from the group you create to scale the objects together?

I transform group and objects in it transform together as children, and after I return objects to the scene one by one by “.attach” method. Maybe I have to “bake” any way transformation before I return it to scene?

if you are getting rid of the group then obviously you have to consider that you are going to loose some transformations. But I don’t think there is a way to get to the same transfomation you had when you used a group after you remove it. You have to keep groups there or the objects will only get scaled, rotated from their individual origin.