I would like to make a 2d top down scene with 3d Objects. I could make a 3D scene and just tilt the camera 45 degrees on X and that would give me basically the same thing(I think). But I started with a 2d project and slowly it became 2.5D and it was time to replace the flat 2d images with top down pixel art. But making pixel art takes time, so I decided to use 3D Objects instead. I got it to work but I don't know why I had to use those specific values. Nor can I find any sources on how this is usually achieved.
The way I made it work was to Rotate the Player Object by 56.06f on X, 0 on Y and angle - 90 on Z. This is the whole code:
var mouseInWorldSpace = Camera.main.ScreenToWorldPoint(Input.mousePosition);
var dir = (mouseInWorldSpace - transform.position);
var angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(45f, 0, angle - 90);
And I also had to rotate the child visual object by -90 on X. But why? Here is the final result https://imgur.com/a/5OahMuS
Rotating in 2.5D with a 3D Object in a 2D scene is weird. If the view was top view then you would only need to rotate on the Z axis. You wouldn't have to touch the other axis nor would you have to touch the child visual object.
The problem here is that its a 2d scene, which means the character can only move on x and y. The Camera shouldn't rotate at all. It shouldn't be so confusing. If it was a normal 3D scene then you would only tilt the camera 45 on x and you would be done. The character would move on X and Z. The only difference here is that its X and Y, and not X and Z. But for some reason I just don't understand how to make it work in a 2d scene. Why did I have to rotate X to -90 on the child visual and then another 45 on the parents x. And for some reason I couldn't combine them. If I made the parent use -45 then it breaks. And the Z have to use angle - 90. Could someone help me or point me to a rotation/Vector/Quaternion source so I can learn why this worked.