Trouble with camera resize and angle calculations
Hi everyone! It's been a while—I took a break but I'm coming back now to (hopefully) finish a game I put on hold. And I just ran into an issue I'm struggling to resolve. So let's dive in!
In my game, I'm calculating angles to rotate an actor based on the user's touch position. I've implemented this behavior by way of help from all of you over the past few months (thank you!). I'm also using an unlocked actor to control camera adjustments so I can account for different devices (also found via these forums!).
My game project is built for iPad Portrait. Everything works great when testing at this size. But when I change the device to anything else and set it to Stretch, the camera rules in the unlocked actor become active. Visually, this works perfectly! For example, a circle is resized to remain a perfect circle no matter what device size I'm using—good! However, SOMETHING is breaking—angles are not calculated correctly on device sizes other than iPad Portrait. This becomes evident when you touch to rotate the actor I mentioned above. Interestingly, the calculation is correct at angles of 0 and 180, but the errors gradually become more of a problem as you approach 90 (and 270).
I have no doubt that my descriptions above are confusing, so I've attached an example file. Just click and drag around the circle to rotate an actor. Change the device size and you'll notice the errors. Now, turn OFF all of the rules in the unlocked "cameraController" actor and the errors disappear.
Please help! And don't hesitate to follow up with questions so I can clarify my issue, if necessary.
Thanks in advance