PDA

View Full Version : Adding two values of channels with Expressions?



Sculley
09-26-2003, 05:00 PM
I've need a way to add two values of two different objects... the channels are both X. I need to Have the values added togeather with one of the objects original channels. Problem is I cant figure how not to just make it use the channels values I'm adding.

Any ideas?..

The idea is I'm using a null constrained by two nulls following a path (well.. a motion) and then using the Y values to create an excelleration and decelleration for a coaster. It works fine until you try and add the acceleration value to the X channel.. which needs to constantly add on to the last value.

Not sure if this makes sense?.. but simple I need to add (channel.x's value + channel.x value) to the original channels value at the frame to make it keep adding on.

Thanx

toby
09-27-2003, 02:07 AM
Richard Brak, www.richardbrak.net , has a great tutorial on expressions, you may find the answer there -

freedik
09-27-2003, 07:32 AM
Man, I was struggling with the same thing a while ago. Had a thread in LWG3D (http://lwg3d.com/forums/forumdisplay.php?f=231) but it got deleted since they rebuilt the whole thing.

All I can say from my experience is that LW's expressions are actually VERY limited. You can't ADD values. I spent several days just to find it out :( :( Maybe you can make wheels to rotate along one axis but that's it...

I learnt some LScript in hope that it would do it, but nah.

My post isn't too helpful I guess, lol. But just don't get your hopes too high....

Sculley
09-27-2003, 07:44 AM
I've found it doesnt add cos it gives errors.. loop detected and so on.. but after a while I thought..hey..I'll try anything and baked the keys for the Null's channels I wanted to add to the null.. and strangely it does the equation now. Seems you can add but only from Keyframes.. otherwise it jsut adds the last key created.. which for me was the frame 0 positions.

Guess the secret is get so far.. and bake the keys.. and work on to the next.. just doesnt allow much automation for changes :(

freedik
09-27-2003, 08:06 AM
Yup, that's pretty much the same conclusion that I came up with. Baking is the only way. Same thing with dynamic parenting. It really suqs, to be honest :S

Freedik.