Jump to content

Basic expression question


Doum

Recommended Posts

Hey guys,

I'm following this tutorial Beginners - Houdini Expressions Tutorial and trying to push it a bit further. I want to make a condition for the uniform scale of my copy and set a limit if the number of copy is greater than 100 stop to cumulate the scale transform . I tried something like that if($NCY<100,ch("../scale2"),???) and if it false I want to use the uniform scale of the last copy before 100 and stay with that value until the end of the frame range.

Someone can help me with that?

Thx

Doum

Link to comment
Share on other sites

I'd put the scale channel into a clamp expression which will limit the number to the given range.


if($NCY<100, ch("../scale2"), clamp(ch("../scale2"), 0, 100))
[/CODE]

Replace the 0 and 100 arguments for the clamp with whatever you want. If you want those values to be determined automatically it might require more than just expressions, like a for loop (like the For SOP) that keeps track of the values as it goes.

Link to comment
Share on other sites

You should make sure to use the proper Variable. $NCY returns you the total nr of iterations $CY returns you the current iteration.

so if($CY<10,0.8,1) is if the iteration is smaller then 10 then scale with 0.8 else use 1 meaning don't scale down any further.

Link to comment
Share on other sites

You should make sure to use the proper Variable. $NCY returns you the total nr of iterations $CY returns you the current iteration.

so if($CY<10,0.8,1) is if the iteration is smaller then 10 then scale with 0.8 else use 1 meaning don't scale down any further.

Nice, that's a lot cleaner than what I suggested.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...