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?
How to snap an object to another precedurally?
3998 4 0- raincole
- Member
- 539 posts
- Joined: Aug. 2019
- Offline
- Andr
- Member
- 899 posts
- Joined: Feb. 2016
- Offline
- raincole
- Member
- 539 posts
- Joined: Aug. 2019
- Offline
Andr
Check "Match Size" Sop
In this case Match Size SOP works, 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 by raincole - Jan. 2, 2022 03:22:21
- animatrix_
- Member
- 4714 posts
- Joined: Feb. 2012
- Offline
Hi,
You can do it generically like this:
Find nearest point wrangle code:
Sort by dist attribute.
Move wrangle code:
You can do it generically like this:
Find nearest point wrangle code:
int pt = nearpoint ( 1, @P ); vector p = point ( 1, "P", pt ); @dist = distance2 ( @P, p ); i@nearpt = pt;
Sort by dist attribute.
Move wrangle code:
int pt = point ( 1, "nearpt", 0 ); vector p0 = point ( 1, "P", 0 ); vector p1 = point ( 2, "P", pt ); @P += p1 - p0;
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
- raincole
- Member
- 539 posts
- Joined: Aug. 2019
- Offline
-
- Quick Links