View Full Version : Expressions puzzle (for me at least)...

 michaelb10 October 2004, 12:51 PMHi, I have a question I hope will be simple enough for someone to solve. (Please, please, please.:) I tried using the Expression Builder, but didn't get too far.) The enclosed picture shows what I'm trying to accomplish. The Base null has total keyframed freedom of movement on the X, Y, and Z planes. I don't want to parent the Top null to the Base null, but I do want to be able to limit it's keyframed motion to a certain range in height above the Base null, in this example, between 2 and 5 meters above the Base null. Is there a way to do this? (Help, help, oh, please, please, please. :))
zuzzabuzz
10 October 2004, 01:30 PM
Expressions override key frames, so you're not going to get the freedom you desire with this approach.
You might add a third null for the 2-5 meter variation, and use an expression like
R = [base.position.y] + [updown.position.y] and assign it to the Top null.

Not sure if there is an expression to limit motion, since (as said above) expressions override keyframes.
---

Or, you could parent two guide nulls to the base...one @ 2 meters and one @ 5, and then you could keyframe your top null with a visual guide of the safe zone.

faulknermano
10 October 2004, 02:06 PM
Expressions override key frames, so you're not going to get the freedom you desire with this approach.
.you can use additive expressions. the constant called "Value" can be used to refer to current keyframe values.

Exp: Value + sin(Time)

edit:

regarding the problem: i've only had time to figure the maximum part out

[top2.Position.Y]>5.000?5.000:[top2.Position.Y]

i made two nulls called "top" and "top2". attached the above expression to "top.Position.Y". i keyframed top2 as a controller for "top." the expression limits the movement of "top" to 5 meters from world location.

michaelb
10 October 2004, 04:01 PM
Thanks for your help. I appreciate it. I never thought of adding another null into the mix. Hmmm... That's given me something to chew on for a while. :)

zuzzabuzz
10 October 2004, 05:12 PM
you can use additive expressions. the constant called "Value" can be used to refer to current keyframe values.

Exp: Value + sin(Time)

Good to know. Learn (or at least remember) something new every day. thanks.

faulknermano
10 October 2004, 05:20 PM
Good to know. Learn (or at least remember) something new every day. thanks.
believe it or not i learned that only recently as well. :)

kretin
10 October 2004, 11:38 PM
Easiest way is with the clamp function attached to the top null:

clamp( Value, Base.pos(Time).y + 2, Base.pos(Time).y + 5 )

That was you don't need any extra nulls. You can move the null outside its limits, but it'll stick to the limits on playback. Here's an example scene I put together:

KeepWithin (http://www.zerogravity.com.au/lw/KeepWithin.zip)

michaelb
10 October 2004, 07:06 PM
Thanks, Jonny. That works swell. :) Thanks for taking the time to whip up a scene for me. I appreciate all the help everyone gave!

kretin
10 October 2004, 12:56 AM
No probs, glad I could help :)

CGTalk Moderation
01 January 2006, 05: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.

1