raincole Posted January 1, 2022 Share Posted January 1, 2022 Say I have a cone and a sphere: I'd like to snap the cone to the closest point on the sphere, along the direction {0, -1, 0}. Like this: I know Ray SOP, but it snaps every point to the sphere: I'd like to keep the cone as a cone. Is there a node to do this procedurally? Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted January 1, 2022 Share Posted January 1, 2022 Add a point underneath, ray and match its position. match_ray_top.hiplc Quote Link to comment Share on other sites More sharing options...
raincole Posted January 2, 2022 Author Share Posted January 2, 2022 (edited) 21 hours ago, konstantin magnus said: Add a point underneath, ray and match its position. match_ray_top.hiplc Thank you! But I'd like to know how to make it more generic. For example when the ray I cast doesn't align with the world axes (e.g. {0.811, 0.32, 0.48}). I'm trying to make something just like Ray but only ray the closest point, and translate the rest of the geo accordingly. Is it possible? Edited January 2, 2022 by raincole Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted January 2, 2022 Share Posted January 2, 2022 Hi rain, isolate the closest point and apply its offset vector to all other points. vector pos = point(1, 'P', 0); vector rest = point(1, 'rest', 0); vector delta = pos - rest; v@P += delta; object_snap.hipnc Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted January 2, 2022 Share Posted January 2, 2022 Here are some ideas. calculate the closest distance to geo for all points and calculate attributes (closest point on target geo or ray projected point, Normal optionally ...) find best point (closest point) add the target point of the best point (add attributes if needed) substract closest point (source) to move object to center (reorient optionally using the direction to center point of the object and up vector the point with highest y-value for example) move geo to target point (reorient geo optionally using N,up) snap_closest_point.hipnc 1 Quote Link to comment Share on other sites More sharing options...
rickvdvulkaan Posted January 3, 2022 Share Posted January 3, 2022 what about the match size node? Quote Link to comment Share on other sites More sharing options...
AntoineSfx Posted January 3, 2022 Share Posted January 3, 2022 Compute N and up for the destination surface, i.e on its points; somehow create the destination point on the surface - it could be a ray, scatter, attribute transfer - anything that interpolates N and up Create your object with the part you want facing the object towards Z, then put a Match Size: Justify Z: min, the other Justify value depends on your geometry, make sure the tip of your object is on the origin. Then copy to points SOP. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.