# Transform Variable Rotation Bug?

**URL:** <https://forums.unrealengine.com/t/transform-variable-rotation-bug/485716>\
**Category:** Asset Creation\
**Tags:** rotator, Instanced-Mesh, unreal-engine, transform, question\
**Created:** [July 3, 2021, 6:09pm UTC](https://forums.unrealengine.com/t/transform-variable-rotation-bug/485716 "2021-07-03T18:09:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spishy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spishy](https://forums.unrealengine.com/u/Spishy)\
**Post date:** [July 3, 2021, 6:09pm UTC](https://forums.unrealengine.com/t/transform-variable-rotation-bug/485716/1 "2021-07-03T18:09:39Z")

</div>

So I’ve made a simple plane to act as a wall in a randomly generated first person maze. The plane lines up with itself perfectly when manually placed in the world, but when using an instanced static mesh, there appear to be weird slits/gaps where you can see through the wall between planes. As stated previously, the maze is randomly generated, and rather large, so using an instanced static mesh is the only good option for performance. Here is the plane mesh below, as well as an image showing the problem.

 ![343143-image-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/6/b66176d8c0b0f0159a71d64fd0fa79dc5fb92dfb.png)

 ![343144-image-2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/d/d/8ddb849b24a25fb59c86d24b1945252b1a3d64e8.jpeg)

The problem is not in my mesh or my blueprints. It appears that when you plug in rotators of 90, 180, 270, etc. into a make transform node, the rotation seems to change ever so slightly. This is shown in the printed text in the second screenshot. It appears to be a strange floating point rounding bug. (I call it a bug because discrete values like 90 and such really should not have weird rounding going on.)

A couple other things to note:

This “rounding” does not occur when using rotators. Unfortunately, since I’m using instanced static meshes, I don’t have the option to set only rotation (all instanced static mesh nodes only take in transform).

I could work around this by modeling/importing 4 separate wall meshes for each cardinal direction. That way, I wouldn’t have to deal with rotating any of them, and could keep the rotation values at 0.0 (which works fine). I don’t like this workaround, as I plan to make multiple wall/floor types, and having to make 4 times as many models does not seem like a viable solution. (This workaround also causes a performance hit)

Does anyone know if I can get instanced static meshes to have perfect rotations of 90 degrees? I’m using 4.25 in this project. If you’d like to try to reproduce the error, simply print out transform values and change the yaw rotations to be discrete numbers, as shown below. When you play the project, see if the rotation stays the same, or if there is weird floating point rounding going on.

![343145-image-3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/1/0/810303d597a1cb998878f860d9c7d3220f8dcbf5.png)

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![Grim\_1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/grim_1/32/88715_2.png) [@Grim\_1](https://forums.unrealengine.com/u/Grim_1)\
**Post date:** [July 3, 2021, 7:13pm UTC](https://forums.unrealengine.com/t/transform-variable-rotation-bug/485716/2 "2021-07-03T19:13:43Z")

</div>

The difference in rotation you see printed on the screen comes from the internal conversion of FQuat to FRotator. The conversion most likely doesn’t happen when you set the rotation of your meshes and even if it did a 0.000015 wouldn’t make any difference, the engine will only consider rotations in the first decimal places because anything else is imperceptible even on very high resolution monitors. I don’t know where your problem comes from (probably a lighting issue) but I am sure it doesn’t come from the rotation of your mesh.

---

<div class="post-metadata">

**Author:** ![Spishy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spishy](https://forums.unrealengine.com/u/Spishy)\
**Post date:** [July 3, 2021, 7:59pm UTC](https://forums.unrealengine.com/t/transform-variable-rotation-bug/485716/3 "2021-07-03T19:59:29Z")

</div>

Just for testing purposes, I tried spawning the walls in as components using transform (instead of using an instanced static mesh). The slits were no longer present. This means you are right, this does not appear to be an issue with the rotation.

 ![343147-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/5/6/956f875b49a9eb5ff7e6031a5a3cec244b8c79e0.png)

I’m not sure the issue would be with the lighting or any external source, since swapping the instanced static mesh for individual components seems to fix the issue. Perhaps it is a bug with instanced static meshes? I did find another thread that suggests there is some scaling bug with instanced static meshes.

> [@Odd Scaling Bug with Rotated Instanced Static Meshes](https://forums.unrealengine.com/t/odd-scaling-bug-with-rotated-instanced-static-meshes/111198):
>
> Good Evening, I built a map generator that takes random walks and lays down tiles, and then adds walls along the borders. While testing, I discovered a “leak” along all the walls that required rotation. (The northern walls, aka spawned with no rotation, are fine). All the other walls (the ones that require rotation) have this issue. On inspection of the walls, I discovered that it seems they have all been scaled down ever so slightly (probably to something like 99% of their original size). Thi…

---

<div class="post-metadata">

**Author:** ![Spishy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spishy](https://forums.unrealengine.com/u/Spishy)\
**Post date:** [July 3, 2021, 8:12pm UTC](https://forums.unrealengine.com/t/transform-variable-rotation-bug/485716/4 "2021-07-03T20:12:14Z")

</div>

Okay, I’ve tested scaling up the instanced static meshes that have been rotated (according to that forum, instanced static meshes that were rotated were scaled down ever so slightly).

 ![343148-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/5/5/05526da37031ceeaaf83037dfa33eba9baae39d9.png)

And as we can see, there are no longer any gaps in the walls.

 ![343150-2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/d/7/ad7433544dca3dd3da3b9a68b01c242f862eb355.jpeg)

It looks like setting the scale of instanced static meshes that have been rotated to 1.000001 undoes the slight shrinkage. The models aren’t “too big” either, as there is no visible clipping of planes along the corner in the screenshot.  
I’ll go ahead and mark this as the solution.
