Closest point

Hi Guys! I am trying to get a solution for drawing the closest point on polymesh in maya.
I have an inMesh & refPoint attr on the left side of canvas node. It would be cool to extend to an array this.

I am stucked....could anybody help me out please?

www.davidlantos.com

Comments

  • imp99imp99 Posts: 10
    edited September 2016

    I set up a new network but it's still not showing the closest point.

    www.davidlantos.com

  • Roy NieterauRoy Nieterau Posts: 258 ✭✭✭
    edited September 2016

    Hey @imp99,

    You seem to be really close and hitting a rather unfortunate default settings of a preset (a bug?). The GetClosest method takes a scaling and maxUnscaledDistance to define how it should search. When currently creating these presets in Canvas they have by default respectively scaling Vec3(0, 0, 0) and maxUnscaledDistance 0.

    Once you start setting these values to something sensical we'll be getting close to a working version. A scale of 1, 1, 1 should be fine and increase the maxUnscaledDistance to something that is higher than the distance between the point and the mesh (e.g. 10 will easily work in your scene).

    Then you're making one tiny other mistake with the GetValueAtLocationArray node. It's not asking you to name a new attribute but from what attribute it will try and get the values at the location. This is because from a location it will interpolate the values of an attribute, in this case we want the point positions. That would be the positions attribute.

    Note that with the "wrong" settings on the GetClosest node you'd see the yellow dot appear at the center of the origin, which definitely isn't the closest point. This is because also invalid points are returned in the array. You can filter these with a filter array node and using a GeometryLocation.IsValidArray node.

    Also see attached adjusted graph.


    For Fabric Team: Whilst trying to rebuild this I tried to briefly use the GetPositionAtLocationArray node, but it gave these errors:

    Error:  : GetPositionAtLocationArray_1:5:7 : syntax error, unexpected $
    Error:  : GetPositionAtLocationArray_1:1:1 : missing dfgEntry
    

    Sounds like another bug.
    Nevertheless there was a Conversion.LocationToPositionArray with similar functionality that actually did work.

    EDIT: This actually seems to be happening with more array nodes. E.g. Raycast[]. (Tested in: FabricEngine-chagall-Windows-x86_64-20160909-030105) I have the feeling I might be doing something wrong.

  • imp99imp99 Posts: 10

    Thank you very much @Roy Nieterau !
    Now it works well! :smile:

    Only one question I still have. Where I should have read abouth this "position" attribute?
    It is just not clear for me when and what I have to write into attributeName field?
    Is it written somewhere what attrubutes are existed? I did't find any related topic in documentation.

    www.davidlantos.com

  • imp99imp99 Posts: 10

    @Roy Nieterau
    Thank you very much!! I am grateful!

    www.davidlantos.com

Sign In or Register to comment.