View Full Version : Expression's Problem
kpalazov 10-22-2002, 07:40 AM High again still working on my cylinder:) this time I have a problem with expression. I am very new to expression 2 days muking around and I want to achieve the following effect.
I have a (Locator1) I want that locator to never go under a specified y level based on a custom attribute.
So far in my testing I tried to keep the locator above 0. This is my expresion:
if (locator1.translateY<0)
locator1.translateY = locator1.translateY+.1
this is an expresion connected to the locator1.translateY.
What this does is that it disalous for any vertical movement of the locator what so ever??.
This is my problem, I am still able to tranlate the locator in the x and z but I can't change its y value.
I would really appricate an expplantion on why this is occuring as I am still learning how to build expression. I know my maths so please don't be tempted to post a complcated solution.
thanks
take care
Kiril
|
|
MCronin
10-22-2002, 08:13 AM
Is there any particular reason why you aren't just setting the limit using the translate limits information attribute? You can tie it to your custom attribute.
kpalazov
10-22-2002, 08:46 AM
The reason is that I don't know about it thankyou for sharing your experiences I have a look in to what you have mentioned.
thanks..if anyone else has any comments on my expression I would be greatlful.
thanks again
Kiril
playmesumch00ns
10-22-2002, 08:52 AM
expressions do totally take over your channels. This sort of expression is only really useful when you've got say an IK foot that you want never to go below the ground plane, otherwise you just keyframe your thing to not go below a certain level, non?
Try this. Make an IK leg, then put that exact expression on the heel joint (NOT the IK handle) et voila, it works. From what I gather you are trying to do something like this:
if (myobject.ty < mycustomattr ) myobject.ty = mycustomattr;
It's worth noting that you want to actually set the translate value to the desired level rather than adding some arbitrary number. You can't guarantee how far below that value your object will be when the expression samples it: it may be 0.1, 0.001 or 100! This will cause the object to jump around.
kpalazov
10-22-2002, 09:06 AM
playmesumch00ns thanks very much mate what am actually trying to do:
I have a cylinder all rigged- it jumps around and does all kinds of things like that what I wanted to do is make a base which I can move it with . For convenience I wanted to place this expresion on the manipulator grouped with body so that I would not have to worry about constantly going to the attribute panel and and setting translation y to zero, plus for learning sake:)
I will have another look with your expression. Thankyou verymuch for you insight most appriciated.
ALso I wanted to ask, I had a look at the translate limits information attribute but it seems that its only for bones??
thanks again
take care
Kiril
MCronin
10-22-2002, 02:00 PM
Any node in Maya that can be translated, rotated or scaled has limit information attributes. For instance, create a locator, go to the attribute panel, click the first tab (locator1, or whatever) go to Limit Information->Translate, and click the checkbox between to Trans Lim Y and the Min fields. Set the now active field to 0. Now you can move the locator all you want, but it will not go below 0 in Worldspace. You can create a custom attribute with an expression, or use a script to determine where your floor is, and feed the result into this limit to prevent a node from dropping below a point in worldspace.
kpalazov
10-23-2002, 02:30 PM
Thankyou very very much I am such a fool not to have noticed this , right it front of me dooo:)!
I figured out how to connect an expression to the limit so everything is running exactly to plan.
thanks again
take care
Kiril
CGTalk Moderation
01-13-2006, 06:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.