|
Hi, I'd like to move the a mesh's uv.x value += 512 so it displays a different version of the objects skin that sits inside the same texture. I've seen this: mesh.Clear(); mesh.vertices = newVertices; mesh.uv = newUV; mesh.triangles = newTriangles; Which seems to stretch or shrink the skin. The end goal to is to only move certains vertices so I have some of the skin coming from one side of the texture and some of it from the other side. Anyone know what I'm talking about?
(comments are locked)
|
|
1) Have you consider trying to achieve the effect by manipulating a material rather then animating a mesh's uvs? Materials with texture have a tiling xy AND an offset xy. I would highly recommend experimenting with the material in the editor before writing your script to automate it. You will need to adjust the tiling to get the new skin to work. This will have the effect of stretching or shrinking the skin until you get it right. Next, manipulate the offset x or y. This will slide the entire texture map across the surface of your object. Once you understand how get control over that, then write the script that manipulates the material. 2) It is difficult to understand your question without seeing it. Can you post an concept image that describes the look you are going for? Here's an example. The first picture is the original undamaged texture, the second is a texture that shows the entire object damaged and the third represents only 1 face of the object damaged. [url=http://i.imagehost.org/view/0319/test2][img]http://i.imagehost.org/t/0319/test2.jpg[/img][/url]
Apr 20 '10 at 03:35 AM
David O'Donoghue
Apr 20 '10 at 03:36 AM
David O'Donoghue
I wouldn't advise doing this since it will create a new instance of the material thus another draw call
Jan 14 at 06:40 PM
Next Beat Games
(comments are locked)
|
|
Offsetting only a few triangle's worth of UV's is going to be needlessly complicated.. However, if you wish to offset the entire UV set of an object, i wrote this.. This helped me tremendously after hours of searching and not finding what I needed.. Thanks!
Jul 13 '12 at 10:59 AM
cynicalwanderer
thanks for this code, i tried to paste it to a simple instantiation and it runs ok but the UV's of all the clone objects are still the same.
Sep 07 '12 at 12:29 PM
ZoomDomain
(comments are locked)
|
|
Don't know how old this is, but I wrote a script that let's you slide UVs in the editor visually while still batching. It's a little buggy, but it works :) Link: http://ethanredd.tumblr.com/post/35949640385/simple-free-uvslider-i-wrote
(comments are locked)
|

As a general note: 512 sounds like you are talking about a shift of 512 pixels. However, uv's are always given in a resolution-independent, normalized space. So if your texture is 1024x1024, a 512 pixel shift would be uv.x+=0.5