MAXON CINEMA 4D: Cinema 4D Forum Adobe After Effects Forum

# Xpresso: linking rotation to movement velocity and direction?

VIEW ALL
 Xpresso: linking rotation to movement velocity and direction? on Oct 29, 2010 at 9:18:54 pm

Hi, an Xpresso question...

I'd like an object to 'lean into it's movement' a little. So when I move it in direction X, it will rotate a bit (along the z axis) and thus lean into the movement.

It seems I can get "position velocity" from an object in Xpresso - but I can't really get the result I'm looking for yet.

Any Xpresso wizards in here?

Cheers,

Barend

 Re: Xpresso: linking rotation to movement velocity and direction?on Oct 30, 2010 at 8:04:25 am

Okay, I'll see if I can add some ideas.

I think what I'd need is some Xpresso that aligns the object to it's motionpath - but the amount would be triggered by the speed of movement.

On a descriptive level I think it might work like this:

1) Calculate motion direction by comparing current position to previous position.

2) Compare current (keyframed) rotation with the motion direction and calculate the transform needed to align the object fully to it's motion path.

3) Calculate speed of movement and use it to control the amount of transform that is mixed in.

So the faster the object moves the more it will be aligned to the motionpath.

But I'm lost in trying to build this...

Raamw3rk - digital storytelling and visual effects

 Re: Xpresso: linking rotation to movement velocity and direction?on Oct 30, 2010 at 10:26:14 am

Here is how I do that.

I learned this off the base80.com site while back.... I highly recommend his site if you want loads of these tips.

I just saw I have the Math Node set to ADD that is wrong swap that to subtract.

/Randy

 Re: Xpresso: linking rotation to movement velocity and direction?on Oct 30, 2010 at 10:37:03 am

Hi,

Thanks for thinking along.

Actually what you're doing is basing rotation on the accelleration, but by coincidence I just stumbled upon that example at Base80 and it did help me get to a solution, I think.

I'm using the Position Velocity > Vector2Reals into a Math Divide into the object rotation.

I need to tinker a bit more to see if it does everything I need.

Barend

Raamw3rk - digital storytelling and visual effects