Bit of a noob question that im struggling with, any help greatly appreciated.
Im trying to position an object along a curve based on ramp position. Basically a visual marker to indicate where along the curve the ramp is selecting. Can be any object (sphere, perpendicular line, whatever). And for it to add more of these ‘markers’ for each ramp point that gets added, and of course updated if the point is moved.
A ramp does not make sense, but a slider does. You can use the Carve node to shorten or extend a curve to its maximum length. The last point on the curve is point #0. If you delete all other points, you will have a single point moving along the curve. Copy an object to it to visualize where the slider will leave you along the curve.
Correct me if I'm wrong, but I think the goal was to have multiple points on the curve at once? Here is an example where each point on the curve corresponds to the x position of the ramp point.
this is a really nice technique! I would like to use it for custom digital assets. Do you know how one also can get the “elevation” value of each ramp point?
If you look at the python docs for a ramp python object [www.sidefx.com] you will see a values method which will return the values of the ramp points. Each value in the values tuple corresponds to a key in the key tuple.
Maybe better code, with all ramp infos as attributes
stringrampname = "myramp";
// use next line to create a ramp, you can not use variable as name here// float ramp = chramp("myramp",0);// see below, we add 1 because of the ramp marker numbers// they start at 1 not at 0, i've added it here and for loop starts with i = 1floatcount = ch(rampname) + 1;
for (inti = 1; i < count; i++) {// create prefix, a markers name is rampname + markernumber// eg. myramp1, myramp2, ...stringramp_pt = rampname + itoa(i);
// then add the value to grab, hover the Position label to see the name// eg. myramp1posfloatramp_pt_pos = ch(ramp_pt + "pos");
floatramp_pt_value = ch(ramp_pt + "value");
floatramp_pt_interp = ch(ramp_pt + "interp");
// set the primuv vector to grabvectoruv = set(ramp_pt_pos,0,0);
vectorpos = primuv(1, "P", 0, uv);
// create a new pointintpt = addpoint(0,set(pos));
// and add desired attributes or groupssetpointattrib(0,"ramp_pos", pt, ramp_pt_pos);
setpointattrib(0,"ramp_val", pt, ramp_pt_value);
setpointattrib(0,"ramp_interp", pt, ramp_pt_interp);
setpointgroup(0, "copy", pt , 1);
}
Edited by matthias_k - 2020年2月14日 01:30:52
English is not my native language, sorry in advance for any misunderstanding :-)
Do you happen to know where these “secret” ramp channel names (name+N+pos|value|interp) are documented? I can't find any references to them in the Houdini docs.