- Home /
reversing object scale is ruining the texture coordinates ?
Hello everyone,
I just noticed a weird bug in my painting script, suppose am painting a quad with (1,1,1) scale, when i log the contact position (texture coordinate) between the brush and object, i got the correct expected result (bottom-left = (0,0) ) Now when i do the same thing with the same quad but with an x-scale = -1 the log result is kinda weird, for the X coordinate everything is normal (the right bound become 0 ) but for the Y everything is messed up, the highest value become in the middle of the object, i can fix this by not reversing the object at all and instead use a new texture, but i think some good math can help on this right ?
thank you and have a great day
I away and cannot test it, but try reversing your texture using $$anonymous$$aterial.mainTextureScale rather than using the Transform.localScale.
still messed up, the whole problem is because am reversing only on one axe, i think a new texture is a must...
Always setting me in the right path ^_^ evrything works perfectly after doing what you suggest and then multiplying two variables by the material mainTextureScale.x, the variables are
Pixel X coordinate of the painted Texture
Pixel X coordinate of the new target Texture
Thank you !! please change that to an answer so i can close the question :)
Your answer