Ho una mesh triangolare e ho utilizzato uno script in Python per traslare un suo vertice (condivido con voi tutti gli script utilizzati, in caso possa essere utile a qualcuno). Il mio dubbio è il seguente: come posso creare un’animazione per questa traslazione utilizzando solamente script Python?
obj = bpy.context.object
edge = obj.data.edges #An edge, the first one
vIndex1 = edge.vertices #Get the indices of the vertices of this edge
vIndex2 = edge.vertices
v1 = obj.data.vertices[vIndex1] #Get the corresponding vertices
v2 = obj.data.vertices[vIndex2]
vCoord1 = v1.co #Get their coordinates
vCoord2 = v2.co
edgeVector = vCoord2 – vCoord1 #The vector formed by these two vertices
edgeVector.normalize() #So that it has 1 unit length
distance = 0.5#Say we want to move v2 of this distance of 0.5 units
v2.co += edgeVector * distance #Translate the vertex
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.