Rectangle rotation

Hello world,
the problem that I’m struggling with is probably very trivial for all of you however I am a Unity newbie and I’m not sure what stands behind the behavior I see.
So, I’m creating a simple 2D game and I want to place a rectangular platform in a scene. It works fine, but after the rotation I see that its walls are not perpendicular, what is seen below.

The same object with no rotation applied:

Can anyone explain me why this is happening and how to rotate the object so it would still be a rectangle?
If you don’t want to lose your time for such fundamental problem (well, I think it is a fundamental knowledge) I would be glad if you provide me some topics so that I can understand this behavior and learn more on my own.

In addition - I am using an orthographic camera projection so it is not the cause of the problem.

How are you rotating it? Make sure the rotation is only on the Z axis.

I am rotating it manually using only Z axis. In this case rotation along other axes doesn’t make sense, I’m not such a newbie :smile: Anyway, good point since I didn’t mentioned it in the question

Haha okay. So how did you create this object, is it a basic Sprite using SpriteRenderer? Does it have any parent hierarchy? Is your camera rotated?

Something is set up wrong in your scene, because skewing shouldn’t happen like that by default.

In fact I am sure I didn’t change anything in settings, the environment properties are set to their default values and the camera is not rotated. I will attach the screenshot of the rotated object, it will be easier for you to analyze this.

Ok, you may be right with the scene settings. When I create a new scene and then place the sprite the same way as I did previously there is no skewness on the object. I don’t know what I did but I can swear that it has not been done consciously :smile: So, for now I will use the new scene however I would be glad if you could explain me what is wrong with the current one. Of course this is not a demand! If you find it funny and instructive (I hope it’s a proper word, I’m not a native speaker :wink: ) and you want to find the solution I’ll be waiting here for it

Wow, it’s not the scene. I was duplicating the objects and then rotate it. Now I have added a completely new object and I have attached the same components to it and the rotation works fine. I can’t see what parameter causes such behavior because those objects are identical in the inspector. But thankfully now it works!

1 Like

I’m glad you got it working. I have no idea what could’ve been causing that if all that you have said is true. I would need to pick apart the project to really find it, but for now I think you shouldn’t worry about it and just move on.

Ok, I have found the reason of this. I was creating an empty object “Map” to which I assigned every such platform. Rotating a Map’s child causes the skewness. If the object is not a child it can be rotated properly. Any workaround so that I can keep all my map elements as one object?

As long as the parent isn’t rotated, the children should be able to rotate about the Z axis without orthographic skewing.