Equivalent of Modo's falloff

   2284   5   1
User Avatar
Member
340 posts
Joined: June 2017
Offline
How would I create the equivalent of a modo falloff in VEX to do the following:

I have a tube oriented vertically (along y axis).
I want to move points outward along normal direction according to a ramp that depends on the @P.y position, and then adjust the ramp.

I know it should be simple, but I must be missing a step in what I've tried. Thanks.
User Avatar
Member
472 posts
Joined: July 2005
Offline
Here is very simple vex setup

Attachments:
push_by_y.hipnc (93.5 KB)

User Avatar
Member
340 posts
Joined: June 2017
Offline
That is perfect! Thank you. This is what I was trying to do (your node was renamed "ShapeTire")

One quick question though. According to SideFX help, relbbox(position) is going to be deprecated. Should this be written as relbbox(0, @P)?
Edited by Island - June 16, 2021 18:34:18

Attachments:
Wheel.mantra_ipr.0001.jpg (107.7 KB)
Wheel.hiplc (616.1 KB)

User Avatar
Member
340 posts
Joined: June 2017
Offline
By the way, rather than use normal, I tried the following code, but it gave error messages. Do you know what is wrong?

float u = relbbox(0,@P).y;
float r = chramp('ramp', u);
v@outward={@P.x, 0, @P.z};
@P += r * @outward;
Edited by Island - June 17, 2021 13:14:28
User Avatar
Member
359 posts
Joined: April 2017
Offline
When constructing vectors from variables, you can't use curly braces; you have to use the set() function. Also, you're binding the vector attribute v@outward, but later just referring to it as @outward... it's good practice to always use the v@ prefix for vector attributes. That said, unless you need that value bound as a point attribute, you could just create it as a local variable instead.

Also, you can't multiply a scalar (r) by a vector (outward). You can only multiply vectors by scalars.

float u = relbbox(0, @P).y;
float r = chramp("ramp", u);
vector outward = set(@P.x, 0, @P.z);
@P += outward * r;
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
340 posts
Joined: June 2017
Offline
Thank you. I wonder why multiplying a scalar by a vector requires a certain order. In mathematics, that is commutative/equivalent.
Edited by Island - June 17, 2021 16:00:15
  • Quick Links