Given the above information, I want to create a rivet deformer that will cause each object in input 0 to stick to the target geometry at input 1. The location on the surface of the target geometry that each object should follow, I'll call this the "targetLocation", is that location which is closest to the location of each object's "rootPoint" point and the starting offset between each object's "rootPoint" and the "targetLocation" should be maintained, as should the orientation of the object, relative to the normal of the "targetLocation".
That's how I posed my situation to chatGPT. chatGPT's response was logical but insufficient.
Note that the "objects" are feathers.
I already have part of the problem worked out. With the VEX code below, running in detail mode, I've obtained the skin location that is closest to the root of each feather and stored that in a point attribute, "feaRootPositionOnSkin". I've done this prior to any animation and in reference to the rest skin, so those values shouldn't change. I've done the same for the offset between each point's location and the "feaRootPositionOnSkin" and stored that as the point attribute "feaRootPositionOnSkinOffset".
I'm stuck on how to proceed from here and am hoping one of the fine folks here will be able to help.
string feaInstanceIdsList[] = detail(0,"allFeaInstanceIds"); int numberOfFeathers = len(feaInstanceIdsList); //run through one feather at a time foreach (string fea; feaInstanceIdsList){ int feaPnts[] = {}; vector skinPos; int j = 0; int rootPointID; vector rootPos; //get pointNum of all points belonging to current feather //when the rootPoint is encountered, get its location on the skin for (int pnt = 0; pnt < @numpt; pnt++) { if (point(0, "feaInstanceId", pnt) == fea) { feaPnts[j] = pnt; j++; if(inpointgroup(0,"rootPoint",pnt)){ rootPointID = pnt; // Get the world coordinate position of the current point in the "rootPoint" group rootPos = point(0, "P", pnt); // Get the closest skin location to the position of the rootPoint int skinPrim = -1; vector skinParamUV; float maxDist = 1.0; float dist = xyzdist(1,rootPos, skinPrim, skinParamUV, maxDist); skinPos = primuv(1,"P",skinPrim,skinParamUV); } } } //store the closest skin location and the offset between it and each point's position foreach(int pnt; feaPnts){ vector pntPos = point(0, "P", pnt); vector skinPosOffset = pntPos - skinPos; setpointattrib(0, "feaRootPositionOnSkin", pnt, skinPos, "set"); setpointattrib(0, "feaRootPositionOnSkinOffset", pnt, skinPosOffset, "set"); } }