Jump to content

Additive Animation


Recommended Posts

Hi,

I try to redo some of my recent 3dsmax discoveries in houdini.

Yes, I have to admit I still have a relapse every now and then.

This time is is about:

additive animation

I know I can set a variable/spare channel to hold $speed and set the x transform of a object:

$F * $speed

This works well, as long as the the object is moving all the time.

but what if there is boolean switch like:

$moving

$F * $speed should only be added to the current position if $moving is true.

How would one do this the houdini way?

I tried 'set/setenv' in a custom function and probably missed the right syntax as it just threw an error.

Georg

Link to comment
Share on other sites

If it's a one-time stop, then you could do something like min($F,40)*$speed, which would stop your animation at frame 40. If the scenario is more complicated, i.e. multiple stops and starts, then I'd figure out how to create a square wave where it's 0 when there's no motion and 1 when there is, and slurp it into an area CHOP.

-- Antoine

Link to comment
Share on other sites

lurp it into an area CHOP.

Thanks Antoine,

the area CHOP was my last thought last evening and my first thought this morning.

It is good to know I haven't been wrong - but it is an disturbing situation, nevertheless.

As the area CHOP outputs the integrals of a given function and way is a function/derivative of speed - this is the way to go.

Georg

Link to comment
Share on other sites

The areaSOP approach worked very well for my first experiment:

a rotor that is controlled by a on/off switch and a RPM-parameter.

But on ran aground on my next experiment:

I have an animated cube: it just travels from -3 to +3 in tx.

How do I calculate the way traveled?

If I just use the area for tx - this isn't the way traveled.

I tried a spare parameter with

ch("./tx") - chf("./tx", $F -1)

but this is neither speed nor acceleration?

I want to add this "distance" every frame to a channel.

chf(".", $F - 1) + ch("./tx") - chf("./tx", $F -1)

didn't work either.

Maybe you can shed some light on this issue

Kind regards,

Georg

Link to comment
Share on other sites

I had another idea:

a spare channel with this expression:

{

float sum = 0;

for (i = 0; i<$F; i++){

sum += chf("./tx", i) - chf("./tx", i - 1);

}

return sum;

}

This does what I was looking for ... I guess.

Georg

Link to comment
Share on other sites

to keep this complete:

{
	 float sum = 0;
	 for (i = 0; i&lt;$F; i++){
		sum += length(chf("./tx", i) - chf("./tx", i - 1), chf("./ty", i) - chf("./ty", i - 1), chf("./tz", i) - chf("./tz", i - 1));
	 }
	 return sum;
 }

this is the *real* way traveled - not just in x.

Link to comment
Share on other sites

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...