Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2009
    Posts
    8

    "Floating limits" in rigging

    Hi,

    I know how to set up basic parametr limits like clamp(cubic(),-1,1), fit expression, and by digital asset(lock range). But when I try to do something like floating limits I cant move forward.

    Example: I have "circle" and in center "null". I dont want to move the null over boundery of circle, only in space inside. But when I solve this by expresions and procedures I know Im stucked in problem called "Infinite recursion in evaluation".

    My way was quite simple:
    Circle radius = 1
    For known "x" from interval (-1,1) exist equivalent interval for "z" values and so on.
    So I evaluate "x" parametr and try to calculate interval for "z" and this set to limit in clamp function. But this seems to doesnt work.

    Do you know how to do this?

  2. #2
    Join Date
    May 2002
    Location
    UK
    Posts
    2,807
    The interesting thing here is that you're trying to affect a parameter that needs user interaction by an expression.

    I'd approach the problem in the following way: Have a null object (with no graphical representation - i.e. no geometry - you're simply using it for its transform) that the user provides the translations on (interactively, via the move tool; or via parameter entry etc). You can then use the translational values from this transform and apply them to a null that has a graphical representation (this is the final object you'd see in the view).

    This way, you can compare the values to the radius, and generate the final value.

    As for generating the value, the easiest way is to probably:
    - Generate a vector from the centre of the circle to the null (pretty easy, especially if the circle's centre is at the origin - as then you just take the translational values of the null).
    - With that vector, caclulate it's length using pythagoras
    - Compare it's length against the radius.
    - If less than the radius, use the translational values of the null
    - If greater than the radius, scale the vector to a length of the radius, and use this to drive the translational values of the null, such that it sits on the very edge of the circle.

    The great thing about this approach is that it's easy to implement for both a circle and a sphere, if you wanted to do it in 3D.

    Hope that helps,
    Steve

  3. #3
    Join Date
    Feb 2009
    Posts
    8
    Thanks Steve,

    Before you answered I try to archite this by polar coordinates and clamp the radius, but this metod has much more steps than yours. So I use yours.

    Math works fine.

    But I have some problems.
    -At first, I cant select in the view the null with no geometry repesentation, It works for me only in network view.

    -And second, when I move null used only for transforms outside the circle, null with geo representation works fine, stops on very edge and move alnog this border. But the first null stay outside, so if I dont see it how can I select it next time?

    Here is my .hip http://rs407l3.rapidshare.com/cgi-bi...73221656077235

  4. #4
    Join Date
    May 2002
    Location
    UK
    Posts
    2,807
    Hmm, the "problems" you're experiencing are to be expected with the exact system I described above.

    The ideal behaviours you're describing, for user input, are to ensure the user can easily select the correct null, and to ensure the translate handle aligns itself with the location of the visible null. Both of these are slightly more complicated to deal with, because the "ideal" behaviour is really down to your personal preference.

    You might want to look into firing off python scripts on user selection to automatically select the invisible null when the user selects the visible null. That deals with the first part.

    As for the translate handle's position... you could possibly ensure the translation coordinates of the invisible null are set to match the translation coordinates of the visible null (as a one time event, setting parameters to absolute values, rather than driving the parameters with an expression - thus avoiding an infinite recursion) in the same selection script. This would behave such that you could move the translation handle outside of the circle, but the visible null would stay in the circle. As soon as you deselect and reselect the visible null, the invisible null's position would snap to that of the visible null, and thus your translate handle would be in the "correct" location.

    Again, this really is down to personal preference, and without spending time researching this problem, I've probably overlooked a more elegant solution.

    Hopefully that gives you something to work from though

    Steve

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •