View Full Version : Using Expressions to create Telescopic Movement

04-04-2008, 01:22 PM
I've posted this in CGTalk as well, but haven't had much luck yet. I apologize if something like this has been covered before... I did a search but I didn't find my answers.

Also, sorry it's such a long post, but I just wanted to make sure things were clear:


So I've been using some basic expressions in LW to tie together various movements. I had never used expressions until this morning.

I've been working on a deicing boom (basically, a big crane arm looking thing). The movements it is capable of includes: rotating around it's main support column, rotating the entire length of the arm up and down, rotating the driver's cab around the point where it's connected to the arm, and finally, telescopic movement of the entire length of the arm.

If you're having trouble visualizing this, here's more:

So far, I've used some basic expressions to pull off just about everything I've needed to do. When you rotate the arm up, the B axis rotation data feeds the rotation of a hydraulic arm, and also makes the hydraulic rod scale x/y from the base. Here's one example:

mapRange(crane:InnerBoom.rot(Time).b, -10, 35, .98, 1.2)

this expression is added on the Modifier tab in the graph editor on the X/Y scaling of crane:Hydraulic Rod

So that's fine and dandy... no problems there. That's the first time I've ever used an expression, just started researching this morning... so I was happy that it worked. Hurray!

HOWEVER, now I want to use another expression... (or any applicable solution I guess) and this time I want to use it for the telescopic movement of the arm. So... like a telescope, the arm is made up of pieces that are nested inside one another. What I want to do, is grab the last piece at the very end, and be able to move that in the X axis... and when it reaches a certain point, it's not only moving itself, but moving the next piece in, and then when those two pieces together reach a certain point, it moves the next piece... and so on and so forth. Basically, I just want to affect the X position of the final piece and by moving that, retract the entire arm... and then later... pull on that final piece and as I move it forward in the X direction, it "opens" the arm back up. This is what I tried to do:

mapRange(crane:Outer Boom(Time).x, 0, -2.94, 0, -1.04)

The range of movement for the final piece (Outer Boom) is this:

Fully extended, it's at position 0, fully retracted, it's at position -1.9.

For the next piece in (called Intermediate#3), its range is 0, and fully retracted it's -1.04

So, the -2.94 is the result of the Outer Boom movement, plus the Intermediate#3 movement.

So I guess in my head I was thinking that would work, but it doesn't. The Intermediate#3 piece starts moving as soon as you move the Outer Boom. So I thought maybe using "clamp" would fix it, but that doesn't work either.

I've tried playing with Relativity, too... but I can't seem to figure it out.

I tried using Follower, but I can't figure out how to make the delay based on X position rather than time.

I started thinking about using an IF statement, but I'm not sure how/where to incorporate that in.

So I'm thinking, that somehow... I need to delay the movement of Intermediate #3, so that it doesn't begin to move UNTIL Outer Boom hits its fully retracted point (-1.9m). However, since I'm new to expressions I'm having a hard time figuring out how I would do this.

Sorry this became such a long-winded post, but to summarize..

I'm new to expressions, and I'm having trouble linking X position movements together for a nested telescopic motion. Any ideas or help, or even links to resources would all be greatly appreciated.

04-04-2008, 01:43 PM
sounds interesting, but FYI I haven't found that many people that can answer questions on LW expressions.

out of curiosity, have you tried relativity? They say its the bee's knees and even easier to use than expressions.

04-04-2008, 02:05 PM
cycler will do it..(or cyclist. I forget which is which.. it's the motion modifier one, not the graph editor one) I wont ruin your fun by explaining further.

04-04-2008, 02:40 PM
I did try using Relativity... but I think I need to find some documentation for it or something, because what little I found in LW's help... I just wasn't getting the hang of it.

I haven't tried Cycler... when I saw that in the pull down I guess I immediately thought it would be something used for cycling motion over time... I'll look into it... as of yet, though, I still don't have a working solution.

04-04-2008, 02:54 PM
Cyclist would be the way to go. You apply it to each part of your telescoping arm.
Each part is controlled by the channel of another item. You would tell each part when to replay the animation you created based on a certain range of the controllers channel.

04-04-2008, 03:05 PM
So in order to make use of Cyclist, do you have to have everything go on over time? Just wondering if everything can be set up on Frame 0, then once it's set, then you can start worrying about keying things over time. So, get all the relations working properly before worrying about keying things. Can you just set start and end time to 0 and -1 maybe? Sorry if these questions seem stupid.

04-04-2008, 03:28 PM
Wow... I just came across this video here:


I think this will help a lot... and I think I get the whole "over time" deal now.

For anyone else who searches this forum... maybe they will come across this post and this video will help them.