- Home /
Round the cube consists of planes (Planetary terrain's chunks proplem).A problem with inverseTransformPoint and TransformPoint functions
Hi, I have a problem with inverseTransformPoint and TransformPoint functions. Below is partial answer on my question http://answers.unity3d.com/questions/1101723/plane-to-sphere-issue.html and its works fine when the planes (chunks) are around verctor3.zero such as on the screenshots in the link above. My problem is that i don't understand how this method can work if i move planes to another position( to 10,10,10 for example, or to any else). Thanks for attention.
Answer by Bunny83 · Oct 16, 2017 at 07:24 PM
Uhm vertices of a Mesh are always defined in local space. If you move an object it doesn't really change the local coordinates.
The code that is presented in the answer over there is not very flexible as it requires the planes to be arranged around the world origin. This doesn't make much sense. Instead you could actually place an empty gameobject in the center of your "sphere" and use InverseTransformPoint of that gameobject to convert the worldspace position into the localspace of the center object where you would finally normalize it.
Something like i explained in my answer over here. My solution allows a higher resolution by using more than 6 meshes. For example 4 meshes per side so 24 meshes in total.
Thanks, i also use several meshes per side. I will try to do how you said at these weekends.
Thanks, its works very well, thank you for your answer, i'm very glad to see the result