My goal: deform a 3D grid along the Y axis to sit flush on top of a plane with animated point position noise. I’m later going to use the 3D grid as a point deformer to “stick” a more complicated mesh with secondary animations onto the deformed plane.
I have a solve that works but it’s kind of hacky: I have the plane with a mountain SOP set to Add, with a Min/Max of 0/1, so all of its points stay above 0 on the Y axis. Then to deform my 3D grid to it, I brought the plane in through an object merge, transformed the Y scale to -1 to invert it, then told every point on my 3D grid to find the distance to the plane geo, and use that distance as the Y position for each point.
Current working setup:
Out of curiosity, I’m trying to solve it in a more elegant(?) way (without having to invert the plane).
My current approach: I’ve separated the points in the 3D grid into 2 different groups—one “floor” group (all points with a starting Y position of 0), then all the others in group “top”. Using the intersect() function, I’ve told the floor points to shoot a ray straight up on the Y axis and find the position it intersects with the plane, and then stored that position as an attribute named @hitPos.
The part I’m stuck on is adding the Y value of @hitPos to the @P.y of every point directly above it in the top group (the points with the same x and z pos). My first thought was to use a For loop on the top group, and use a function like findattribval() to search through the floor group for the point with the same x and z position, then add the @hitPos.y from the point it returns to the @P.y of the corresponding top points.
Where I'm stuck:
Then I figured out findattribval() won't work for this approach. Any idea how I can tell each point from the top group to look straight down, find the corresponding point on the floor group, and add the @hitPos.y attribute to its current @P.y?
Or if you have a smarter way to approach this altogether I'm all ears! Just trying to learn VEX

