VEX: How could I move a point along Normal?

   23351   7   1
User Avatar
Member
426 posts
Joined: 8月 2015
オフライン
Hello;

How could I move a specified point along it's Normal, using point wrangle?
Here is my scene :

Attachments:
Capture.JPG (194.7 KB)
Move Along Normal_01.hip (82.2 KB)

Masoud Saadatmand (MSDVFX)
User Avatar
Member
9335 posts
Joined: 7月 2007
オフライン
just multiply normal vector by the amount and add to P, set group only to points you want to move

Attachments:
Move Along Normal_01_fix.hip (88.5 KB)

Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
426 posts
Joined: 8月 2015
オフライン
Thank you.
Masoud Saadatmand (MSDVFX)
User Avatar
Member
8173 posts
Joined: 9月 2011
オフライン
You're using pointattrib and setpointattrib wrong. If you are running over points, then you can just bind. You are also using the wrong signature of chf. use float chf( string ) not float chf( string, float ). The signature you are using is to specify the point in time of an animated channel from which to sample the parameter.

@P += @N * chf('dist');

pointattrib is the old way of getting a point attribute, it is only used if you need the know whether the import was successful. Use point() if you need to get a value from a point other than the current one (or from a different input). Remember, an attribvop set to ‘runover points’ is already a loop. The code block is the code executed per ‘iteration’ of the loop, which for points is per point. Any bind (@varname) will refer to the current point's attributes to read or write.

setpointattrib is used for when you need to write the value to a point other than the current point. Generally it should never be used when run-over is set to points, as you already have a point to write to, the current point. The exception to this rule is when creating geometry per-point, and you need to set attributes of newly created points. Other cases are when you don't know the name of the attribute to be written in advance, but this can be handled in different ways.
User Avatar
Member
426 posts
Joined: 8月 2015
オフライン
Thank you “jsmack”, good points.
Masoud Saadatmand (MSDVFX)
User Avatar
Member
100 posts
Joined: 10月 2021
オフライン
If anybody would know how often I come back to this thread to get this line of code they would think I am crazy.
www.rehimi.de
User Avatar
Member
9335 posts
Joined: 7月 2007
オフライン
Kareeem
If anybody would know how often I come back to this thread to get this line of code they would think I am crazy.
you may be happy to hear that in H21 Peak SOP has option to mask by point attribute as well as provide custom direction attribute, so no more need to remember any code
https://www.sidefx.com/docs/houdini/nodes/sop/peak.html [www.sidefx.com]
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
624 posts
Joined: 8月 2008
オフライン
what about the peak node? just simple move the slider
  • Quick Links