Dave_ah
What is a good way to arbitrarily limit a numerical range for a channell.
For example I set up a Transform Axis SOP. In that SOP is a rotation channell. Its path is /obj/Body/Left_Jaw/rot. It has a persistent handle.
What I would like is to be able to freely drag that handle but at same time for Houdini to limit its range to 0-60 degree (0- -60 for Right_Jaw). Kind of like bone joint limits where the rotation stops after limits are reached. The intention is so that another person would be constrained to my imposed limits, and so I don't have to worry about overdragging.

What would the syntax of the expression be in the channell?
Thank you
David Rindner
thekenny
Like anything in Houdini there are a number of ways you can do this.

First you can try adding this expression to the channel you want to limit.

clamp(cubic(), 0,60)

It does what you want but most likely you won't like how it does it. Visually it does what you want but if you look at the channels procduces you might see some problems.

A better way to do this is use to objects. Make one channel/handle persitent, keep it free and in your jaw roation xform use a fit expression to drive the animation.

fit(ch("/obj/Jaw_Handle/rz), 0, 180, 0, 60)

Basically all the rotations in the handle will be inside the domain you need them to be.

If you used an actual bone to do the rotations you could use the rotational limits there as well.

Hope that helps somewhat.

FYI, you can use the textport to find all the expressions you can use. typing exhelp in the textport will show you the expression based hscript functions. you get a different return from a straight help.

Good Luck.
-k
Dave_ah
Thank you.

Clamp expression works great and does exactly what I need it to do.
I thought that with cubic() option it would ease the value during dragging, but its of no consequence. I see no problem in the F-curves of a channell with clamp expression. But I kept the curve with in range. I would imagine that if the f-curve exceeds the range it would be truncated or clipped with sharp breaks at offending regions.
Houdini is marvelous. What a great app.

Dave Rindner
thekenny
Yes, if the values are within your limits the resulting channel is fine. It's when it is more or less when you have channel problems. It can be more of a headache when setting up something for mass consumption in the shop. Most animators hate limits/clamps. The next best thing is to set another expression to change the colour of the handle or mesh in question to alert them they have done something wrong.