I’m trying to create a simple and reusable module to make a infinite scrolling parallax background as this playground. But seems to me that it isn’t very reusable since I’m supposing that the original mesh is positioned at the center and this can’t be true at some point. (I will add a property to center the camera on the future, so the camera itself isn’t a problem, well, I believe so )
With this I try to find a way to fit the mesh on the center of the camera, but I only found a way to change the camera target, instead of get its center. So, how do I get the center of the camera? Something just like unity does
What I want to reach at the end is, for anyone that use the package, could just use its meshes on the
InfiniteBackground class and it simply works, without the need to deal with camera or meshes positioning on X, it will just appear on the screen without much effort
BTW, changing the subject, I’m wondering if is there a way to get the size of a mesh relative to the camera? I mean, lets suppose that the camera has a total width of 100. A mesh of certain width displays on camera as 50 (the mesh fills half of the camera), but if we change its Z to a further value, now the the relative width is 25. I don’t know if I make myself clear, sorry for that, but what I what to do is know how much side-by-side clones of a mesh I need to create to fill the horizontal axis of the camera and I can’t find anything about this.