Hey everyone,
I´m looking for a procedural way to move all vertices in a mesh which are on the positive Y Axis (world space) a certain distance in the Y direction. Vertices that are exactly on 0, should not be moved.
I´ve played around with DCM for a few hours now, but can´t find a solution.
Attached you will find an example of the desired result on a sphere.
Anyone got some experience with DCM and can help me?
I would like to solve this with DCM, because I have a lot of objects and don´t want to rely on any helper or volume select objects.
Thanks and best
Solved! Go to Solution.
Solved by Swordslayer. Go to Solution.
You can do that with the Maxscript operator, for a fixed distance it would look like this:
on Process theNode theMesh elementType outputType outputArray theTime do
(
if theMesh == undefined then return 0
nv = polyop.getNumVerts theMesh
if nv == 0 then return 0
outputArray.count = nv
dist = 20
for vert = 1 to nv do
outputArray[vert] = if (polyop.getVert theMesh vert).y > 0 then y_axis * dist else [0,0,0]
)
with Maxscript operator set to Replace and Point3 output, plus Vertex Output set to Position - Add.
You can link use custom attributes to link the distance parameter to a spinner, check my previous posts on the topic, but if you want it to work in world space and not object space, you'd have to also add controllers referencing the node itself to the custom attributes, and in the end the amount of code would be bigger than just writing a simple maxscript modifier and maintainability much worse.
Then again, once you make it, it's self contained so it will work on other computers while you'd have to distribute the modifier script with the scene if you wanted it to work somewhere else, too.
@AD_GW wrote:
I would like to solve this with DCM, because I have a lot of objects and don´t want to rely on any helper or volume select objects.
That can only be the reason to use "volume select" over your/suggested method.
You would need only 1 (box) obj. in instanced Vol. Sel. Mod.
Based on your script I found an alternative solution, which works quite well in my case.
Not sure if it´s 100% fool proof though.
Using MaxscriptInput with the script below set to replace and float (0.01 so I can use cm in scale later)
Scale modifier set to multiply
Vertex Output set to position Y and Add
on Process theNode theMesh elementType outputType outputArray theTime do
(
if theMesh == undefined then return 0
nv = polyop.getNumVerts theMesh
if nv == 0 then return 0
outputArray.count = nv
for vert = 1 to nv do
outputArray[vert] = if (polyop.getVert theMesh vert).y < 0.01 then 0.0 else 0.01
)
I am then able to set the scale value with this code:
$.modifiers[1].operators[2].scale
This bit is a little bit unclear to me. It seems like the operators array also holds deleted operaters.
As long as I don´t change anything it´s always on [2], so thats fine so far.
That's not world space...
But I see now why you didnt want to use Vol. Select...
Although you could use it with texture (half black-half white) based sel. and (default) planar mapping in UV Map mod.
Can't find what you're looking for? Ask the community or share your knowledge.