View Full Version : Quick Expressions Question

06-20-2003, 02:11 PM
Hey ppl, I'm hoping someone can give me a quick bit of advice.

Basically I want to write an expression that says this.

IF Pitch+Bank>135 Then Bank = 135-Pitch

Now the syntax would go something like this.


I've tested this expression and it will work on other channels, but when I try to apply it to the Model.Body.L_UpperArm.Rotation.B channel I get the following error..

Loop Detected in expression

I understand in theory that LW is kicking up a fuss because the conditional expression references the same channel I'm trying to apply it to, but I don't know how to get around this problem, and to be honest, in regular programming this is not specifically a loop scenario. It's not causing a loop because I'm saying if the bank+pitch is above a certain value then reduce the bank value so that it isn't any more. The next time it would run through the expression the condition would become false and kill the loop. There would never be a situation where a recurring loop would occur.

Anyone know how I can deal with this?

What I'm trying to do is control the bank rotation of a shoulder joint. As the arm lowers to the side of the body, the arm cant twist as far as it can when the arm is 90 degree raised. So I need to limit the ammount of bank rotation differently dependant on the pitch position of the arm. I can't simply limit the bank to a constant value.

I'm fairly new to LW expressions, so the syntax is often confusing me even although I have extensive programming experience in other languages.

Fingers crossed and thanks for your time.