
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I have two editable meshes representing the same object at two different times. They are exactly the same (same number of points etc.), just in different configurations. I am studying the transition from time 1 to time 2. I applied the Morpher modifier to represent the motion between the two states. What I am interested in is to display the vectors that represent the displacement of each single vertex of the mesh between the initial and the final state. Basically I am looking for a way to connect corresponding vertices with a segment.
For now I have a script that creates static lines connecting corresponding vertices of the two meshes. I am wondering if it is possible to adapt this script in order to make it more dynamic. I mean like automatically adapting the lines when I move one of the two meshes to always keep them connected? I am thinking about displaying somehow the changes in the lines' lengths during an animation (while using the morpher modifier would be perfect, but probably not doable?). Also, is it possible to create arrows instead of lines? I'd be interested in displaying the vectors representing the motion of vertices (pointing to state2 from state1). Thank you a lot!!
Here is the script I am using:
-- Creates lines between corresponding vertices of two selected editable meshes.
-- No error checking is done.
-- v1 12/30/2020 LRM
--
fn Line2Points pointA pointB =
(
ss = SplineShape pos:pointA
addNewSpline ss
addKnot ss 1 #corner #line PointA
addKnot ss 1 #corner #line PointB
updateShape ss
ss
)
fn morph_vectors vstart vend =
(
-- Creates a line between corresponding vertices of two selected objects
-- that have the same number of vertices.
--
for i = vstart to vend do
(
pA = meshop.getVert objA i
pB = meshop.getVert objB i
newLine = Line2Points pA pB
)
)
objA = selection[1]
objB = selection[2]
nV = meshop.getNumVerts objA
nvt = nv as string
rollout vectorRollout3 "Morph Vectors" width:200 height:160
(
button 'btnGo' "Go" pos:[32,104] width:96 height:36 align:#left
edittext 'edt1' "" pos:[64,32] width:78 height:24 align:#left
label 'lbl1' "Start vertex" pos:[0,32] width:65 height:15 align:#left
edittext 'edt2' "" pos:[64,64] width:78 height:24 align:#left
label 'lbl2' "End Vertex" pos:[0,64] width:56 height:16 align:#left
label 'lbl3' "Total number of vertices:" pos:[0,8] width:120 height:17 align:#left
label 'labelnverts' nvt pos:[128,8] width:48 height:19 align:#left
on btnGo pressed do
(
vstart = edt1.text as integer
vend = edt2.text as integer
morph_vectors vstart vend
messagebox "Done"
)
)
createdialog vectorRollout3
Solved! Go to Solution.