Search the Community
Showing results for tags 'move'.
Found 3 results
-
To help those who are searching to do the same, below is a C# script to move the vertices of a pb object : using UnityEngine; using System.Collections; using ProBuilder2.Common; public class MoveVertex : MonoBehaviour { pb_Object pb; //ProBuilder Object pb_Face face; //Object face Vector3 VertCoo; //Vertex Coordinates int[] indices; //List of vertices in the choosen face void Start() { pb = GetComponent<pb_Object>(); //Get the component on the object pb_Face face = pb.faces[0]; //Get the choosen face indices = face.distinctIndices; //Only grab the unique indices - so (0,1,2,1,3,2) becomes (0,1,2,3) VertCoo = new Vector3(0.5f,0.5f,0); //New coordinates StartCoroutine(WaitAndChange()); } IEnumerator WaitAndChange() { yield return new WaitForSeconds(2); //After 2 seconds //We change the vertices' position pb.SetSharedVertexPosition(indices[0], VertCoo); pb.SetSharedVertexPosition(indices[1], VertCoo); pb.SetSharedVertexPosition(indices[2], VertCoo); pb.SetSharedVertexPosition(indices[3], VertCoo); } } To see what it does :
-
Something like this:
-
Is there any way to preserve UV's while moving edges or verts? I'm trying to create a twisty road with 3D sidewalks. I've created a simple road by adding loops to a 1x2 plane over and over again and moving them into position. For my test the road looks like a 90 degree turn going down hill. I then lined up the UV's how I wanted them and my road texture includes a sidewalk. Next I wanted to add depth to the sidewalks but I've hit a snag. I tried inserting a loop but it always centers to the face and that put the edge in the middle of the lane. Any attempt to move that edge destroys the UV's that I previously setup. Even destroying the UV's would be fine, if I could select the entire loop and move it along the edges similar to the way that Max/Maya can, but I can't seem to find any option for that either. What would you guys suggest? Take the sidewalk into account from the very beginning?