Disclaimer: I'm a total beginner and there's most likely better/easier ways
to do it.

If you want to constrain your object to a single point, one way would be to
create an expression on each of the translate channels of your object and
use the `point` function, such as: `point("/obj/path_to_geometry",
point_number, "P", index)` where `index` is 0 for the position X, 1 for the
position Y and 2 for the position Z.

If you want your object to snap to an actual group of points, then the idea
that I've got is slightly more involved.
Basically, you'd need to put your points into a group and create an
`AttribWrangle` in which you'd loop over the points in the group and return
an average position.
Here's a working VEX snippet:

vector @clusterPosition = {0, 0, 0};

int count = 0;
int ptnum;
vector P;
int handle = pcopen(@OpInput1, "P", {0, 0, 0}, 1e6, int(1e6));
while (pciterate(handle)) {
    pcimport(handle, "P", P);
    pcimport(handle, "point.number", ptnum);
    if (inpointgroup(@OpInput1, "group_name", ptnum)) {
        @clusterPosition += P;
        count++;
    }
}

if (count > 0) {
    @clusterPosition /= count;
}


Note that the `pcopen` function creates a point cloud with a K-D tree, so
it's really overkilled here. I'll be looking forward a better answer to
that one! :)

Also both solution will match only the position. To also match the
orientation, you might want to use the attributes created by `PolyFrame`.


On 2 February 2015 at 22:01, philipp seis <dpi...@gmail.com> wrote:

> hey guys, i'd be super happy for any advice on an "object to cluster
> Constraint" in H,
> like i would use it for a dorrito
>
> 2015-02-02 15:38 GMT+01:00 Jordi Bares Dominguez <jordiba...@gmail.com>:
>
>> And the Rivet SOP too
>>
>> > On 2 Feb 2015, at 12:55, a...@andynicholas.com wrote:
>> >
>> > You might want to check out the Creep SOP in that case.
>> >
>> >
>> > A
>> >
>> >
>> > On 02 February 2015 at 12:27 Gerbrand Nel <nagv...@gmail.com> wrote:
>> >
>> >
>> >> Thanks guys!!
>> >> What I want out of a surface deformer is the UV control.
>> >> It's different than a cage or lattice because it lets you slide/deform
>> things
>> >> based on uv data, and offset along normals
>> >> I find it very useful to model things where allot of detail has to
>> follow a
>> >> certain shape.
>> >> I modelled some running shoes in the beginning of the year, and all of
>> the
>> >> parts followed this one master nurbs surface.
>> >> I'll look into the ray sop and lattice, but I think a surface deformer
>> >> digital asset might need to be made :)
>> >> One that works like soft.
>> >> This way I can "engine" it into bloody maya if I ever need to go to
>> that dark
>> >> place again.
>> >> G
>> >>
>> >> On 02/02/2015 12:45, philipp seis wrote:
>> >>
>> >>>> Hi Gerbrand,
>> >>>
>> >>>     from the top of my head i'd say, there should be a checkbox so
>> that
>> >>> your curve
>> >>>     won't get a surface.
>> >>>     Then, here is a curve basics tutorial from peter quint:
>> >>>     http://vimeo.com/40771484 <http://vimeo.com/40771484>
>> >>>
>> >>>     I'd be interested in a deform by surface too. The Ray SOP gives a
>> >>> little bit of that
>> >>>     behaviour out of the box, and the attribute transfer SOP as well,
>> if
>> >>> "match Point Position" ( i guess that was the name) Checkbox is on.
>> Those 2
>> >>> work on proximity.
>> >>>     And finally you might want to try the Lattice SOP, which in
>> Houdini is
>> >>> also customizable,
>> >>>     ending up being very close to the cage deformer from Soft.
>> >>>     And then, you could also add a "Normal attribute" to your SOP,
>> with the
>> >>> point SOP, and create a VOPSOP in which you manipulate those. This
>> might be
>> >>> the equivalent to an ICE "closest point to location" node.
>> >>>     I'd consider myself a real houdini novice though, just trying to
>> >>> transfer my Softimage workflows, so please correct me if i'm wrong.
>> >>>
>> >>>     I would like to add the question: How would you do a simple
>> "Object to
>> >>> Cluster Constraint ?"
>> >>>     So far i found only options that are uv based, like the "rivet"...
>> >>>
>> >>>     best, Philipp
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>     2015-02-02 10:43 GMT+01:00 Gerbrand Nel <nagv...@gmail.com
>> >>> <mailto:nagv...@gmail.com> >:
>> >>>>>> So 3 quick houdini questions if you don't mind:
>> >>>>      Why do I automatically get a surface on a closed curve?
>> >>>>      Can I kill it without killing the curve, or can I set it to
>> "never
>> >>>> create"?
>> >>>>      Is there something like "deform by surface" in soft for houdini?
>> >>>>      That is it for now :)
>> >>>>      Thanks
>> >>>>      G
>> >>>>>>
>> >>>
>> >>>>
>>
>>
>>
>


-- 
Christopher Crouzet
*http://christophercrouzet.com* <http://christophercrouzet.com>

Reply via email to