Jump to content
Breggs

Face translation and UV Positions

Recommended Posts

I'm working on a runtime level editor using ProBuilder.  I have face translation working, but the pb_Object's uv's change when I move the face.  I want them to maintain their position in world space (I think that's the best way to describe it).

How I want the UV's to behave (using ProBuilder tools).

https://gyazo.com/d8ee8d45a145b91a26769abe10d006cf

How they currently behave (runtime editor).

https://gyazo.com/91abbad97d74cb5c605983c2228ce6ff

 

I'm using this line to translate the face.

pb.TranslateVertices (this.selection.face.distinctIndices, this.selection.normal.normalized * dist.z);

 

I would appreciate any help!

Share this post


Link to post
Share on other sites

If you call pb.Refresh() following the TranslateVertices function that will rebuild the UVs.  For performance reasons the act of rebuilding the positions array and textures / normals / etc are distinct.

Share this post


Link to post
Share on other sites

In most places it's appropriate to use the catch-all Refresh instead of the individual attributes.

 

On setting the faces to world space, that's a fine approach.  That ought to make it easy to keep textures aligned.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×