Clarify what isn't working, this doesn't make any sense:> I have this code but it doesn't work the way I want to, so he's shutting down without sliding smoothly
The first issue I can see is that doubling the camera size does not give you it's height:
>float cameraHeight = Camera.orthographicSize*2f;
And you later divide this value by 2f in the ApplyBounds() function, so why are you even doubling it in the first place?
and this line is redundant:
>float cameraWidth = (Screen.width * 1f / Screen.height) *cameraHeight;
Basic math: (w * 1/h) *h will always give you back w, just do Screen.width
I'd start with cleaning out these basic errors in math/logic, then come back to explain what the problem you're seeing is.
↧