sprockets TV Commercial by Matt Campbell Greeting of Christmas Past by Gerry Mooney and Holmes Bryant! Learn to keyframe animate chains of bones. Gerald's 2024 Advent Calendar! The Snowman is coming! Realistic head model by Dan Skelton Vintage character and mo-cap animation by Joe Williamsen
sprockets
Recent Posts | Unread Content
Jump to content
Hash, Inc. - Animation:Master

Recommended Posts

Posted

I'm still learning expressions. Is there a simple way to save a randomly generated value so that it can be used throughout the animation after it's been generated at frame zero?

 

I have a "flock" of stars, and want them to rotate about the Y axis by a constant amount of between -1 and +1 degrees per frame - a bit like they are hanging from a child's mobile. I've used the flocking plugin to generate all my stars - would each have its own variable or would they all rotate by the same amount?

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted
I'm still learning expressions. Is there a simple way to save a randomly generated value so that it can be used throughout the animation after it's been generated at frame zero?

 

I have a "flock" of stars, and want them to rotate about the Y axis by a constant amount of between -1 and +1 degrees per frame - a bit like they are hanging from a child's mobile. I've used the flocking plugin to generate all my stars - would each have its own variable or would they all rotate by the same amount?

 

Just a short possibility:

1.) Create a Null-Object in your scene.

2.) Create an Expression for example for the x-axis-value. -> Expression: If(ChorTime()

3.) Create an Expression for example for the y-axis-value. -> Expression: ..|X

 

Now you can read the value of the x-axis (or y-axis) out and it will be set at the first frame (or whatever) and after that stay the same. Choose any multiplicator you want and that fits you there (*15 can be *2, *0.01 or *1, etc.)

 

*Fuchur*

 

PS: Sorry, this doesnt work out, even so it is quite logicall for me...

  • Hash Fellow
Posted

A:M expressions don't have "variables" in the sense that scripting languages so i don't think a purely expression solution is possible.

 

 

It is possible to do this, however. For TWO, I made the generic Winkie so that any number of them could be dropped into a chor and each one would randomly choose clothing colors and then stick with that choice for the rest of the shot.

 

This was a year ago. I forget the specifics but basically you create two dummy bones for the value you want to work with... "Randomizer and "ValueStorer"

 

Your model has a pose that when ON activates an expression that constantly varies a "Randomizer" parameter, like translate Y value, with "Rand()"

 

Your model has a 2nd pose that when ON activates an expression that makes "Value Storer" take it's translate Y value from whatever "Randomizer"'s is.

 

Your model has a 3rd pose that when ON activates an expression that makes the parameter you wanted to vary-then-hold equal to whatever the Y value of "value Storer" is

 

At the start of the chor you turn on all three poses. the parameter will vary randomly until you hit a framewhere you like the random value, then turn OFF the 2nd pose which will cause a keyframe to be made on the "value storer" bone in its current position, locking the random value.

 

I don't recall the exact specifics but here is the variWinkie in a demo chor you can study. You will need to study it carefully since the mechanism is not obvious and I don't recall the specifics to elaborate any further..

 

They vary their clothes colors until frame 10 when the "storer like random" pose is turned OFF.

 

The also have poses to self vary hair style and body proportions but I left those off here.

 

edit: see simpler example project below

Posted

Could someone tell me, why my solution isnt working?

Can't seem to see why... it looks like the expression wouldn't run in a circle or something but that they are updated constantly by each other. As if there is an actionlistener which is automatically updating the construct at the right places when needed...

 

For example Quest3d works in a big while-construct so that everything is repeated and will only be updated once in a circle (if you dont tell it manually that it should update constantly)

 

*Fuchur*

Posted
...It is possible to do this, however. For TWO, I made the generic Winkie so that any number of them could be dropped into a chor and each one would randomly choose clothing colors and then stick with that choice for the rest of the shot...

Thanks Rob - I did see your thread from last year, but although you said you'd had success, you didn't elaborate further. ;)

 

I'll try the technique and let you all know how it goes. Thanks again...

  • Hash Fellow
Posted

correction:

 

the "2nd pose" I mention above is a regular translate to constraint, not an expression

 

Could someone tell me, why my solution isnt working?

 

basically expressions are all about the here and now and not what happened in the last frame. I wish it worked your way.

 

 

 

Fun fact: before I posted the old VariWinkie example i tried making a simpler example that would be easier to follow. I couldn't get it to work! I don't know why.

  • Hash Fellow
Posted

OK, here's simpler example...

 

VariVase2e.zip

 

 

 

turning pose "random bone" ON ties translate Y of "random" bone to an expression with Rand()

 

turning pose "storer like random" ON constrains "storer" bone to "random" bone

 

turning pose "Red like storer" ON links surface color red value to translate Y value of "storer" bone.

 

turning pose "storer like random" OFF turns off constraint to "random bone" and forces key on "storer" to lock it in current position.

 

 

mystery: once you turn "random bone" ON, the bone will continue to randomize even after you turn this pose OFF or delete its ON keys.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...