Serious scaling issues when objects are parented
- Dominant language
- C++
- Stars
- 3.3k
- Forks
- 353
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 1
Description
**Description**
I encountered a major scaling issue when I was trying to understand transforms in Armory. In the test scene I have four cubes. Two of them have a parent child relationship, and the other two dont. The green cubes are scaled by 0.5 along the X axis. The red cubes are simply rotated along z axis by 45 degrees. The only diffference between the two sets of cubes is parenting. Note that scaling and rotations were not "applied" in Blender.

The image above shows parented cubes on the right and un-parented ones on the left.
When viewed from orthographic projection, here is the comparison between Blender and Armory

From the image, the parented object has wrong scaling. While the unparented one looks correct.
However, when I checked the local transform of the objects in blender and Armory, they were a bit different:

```
arm/MyTrait.hx:18: Cube.002 :
arm/MyTrait.hx:19: Local Transform =
arm/MyTrait.hx:84: Loc:
arm/MyTrait.hx:85: (0, 0, 3, 1)
arm/MyTrait.hx:86: Rot
arm/MyTrait.hx:87: 0, 0, -0.36288262477061145, 0.9318348569567418
arm/MyTrait.hx:88: Scl
arm/MyTrait.hx:89: (1.5683433228513, 1.5683434814930588, 1, 1)
```
The differences were that:
1. The local rotation quaternion (`object.transform.rot`) in Armory was not normalized.
2. The local scale (`object.transform.scale`) in Armory was different form that of Blender
**To Reproduce**
Use the provided blend file and run the project.
**Expected behavior**
The scaling of objects must be proper, even if object scaling is not applied beforehand.
**System**
Blender: 293
Armory: v2021.5 ($Id: 99497c80048d5b0614144ab4b87fb2303e416be2 $)
OS: Windows10
**Test File**
[ScaleRotBugTestFile.zip](https://github.com/armory3d/armory/files/6531903/ScaleRotBugTestFile.zip)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the provided ScaleRotBugTestFile.zip and run the project to reproduce the parented-versus-unparented scaling difference. Inspect the transform values reported from arm/MyTrait.hx, especially local rotation and scale, and compare them with Blender. Done means parented objects retain proper scaling when Blender transforms are unapplied and the local rotation is normalized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- blender
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100