Pointing isn't rude if you use channelfollower! (L6)
A quick tutorial by the Kevman.

Intro
I've been having a good play with L6 lately - And as part of that I've been busy putting together plenty of tutorials so I could share what I've learnt so far with anyone interested.  In particular, the animation side of L6 has been massively enhanced with new tools.  I was attempting to write another Expressions tutorial to target a gun automatically, but there is a much easier method of doing this using another of L6's new graph modifiers - LW_Channelfollower!

Channelfollower allows you to tell any item in the scene to 'follow' the channel of another item in the scene.  In this tutorial, I'll show you how to use this cool modifier to automatically track a gun turret at a moving target!
 
Bang! Bang!  Gotya! As always, I'm not teaching anyone modelling here - What you'll need for this animation is a simple turret object and a barrel object (Make sure these are separate objects because we'll be animating both of them separately!)

In my example, I made simple turret and barrel objects from cylinders - After loading the objects, I parented the barrel object to the turret.  The target is a Null object with a light/lens flare attached.

If you want a sneak peek at the final animation, you can download a Quicktime video clip here (Cinepak, 160x120) or by clicking on the image.


The Process....
Unlike Expressions, there's no maths involved here - The Channelfollower plugin does all the work for us (phew!), but there is some tweaking involved on our part - But more on that later!

Adding the Channelfollower is pretty much the same process as adding an expressions modifier.  Simply open the graph editor, select the object, then the channel you want to animate.  Select the 'Modifier' tab, and Add Modifier / LW_Channelfollower.  Easy peasy.  (Got stuck? You can check out my previous tutorial for a simplistic visual of how to add modifiers)
 
 
Turret follows the Target Lets start by going to our graph editor and selecting our turret model.  We know that the turret will only rotate left and right (heading angle) so we need to make sure that we are always facing the target as it moves across in front of us.

So, we've selected the turret,  we selected the turret.Rotation.H channel and set the modifier LW_Channelfollower.

Double-click to bring up the settings box.  From the list, we select the target (click the arrow to 'expand' the target's channels list).  We know we want the turret to rotate towards the target as it moves along the x axis, so we simply click on the target's Position.X channel.

Now, as the target moves along the X axis, our turret will try and follow it.

Note that I've scaled the movement by 1000% - This is because the movement at 100% was so slight it was almost unnoticable.  This is one field that you may have to tweak yourself to get the turret to rotate accurately...

As for the rest of the settings, if you want the turret to be a bit 'delayed', you can add a time delay in the Time Lag(s) field.  You can also set the start and end frames for the follower, if its only to follow the target for a short time during the animation.
 

That's our turret done...  If you want to test and tweak the turret, simply keyframe the Target object moving across the front of the turret and see how well it works.  If it doesn't appear to be very accurate, tweak the scale value and test again...

Anyway, that's got our horizontal tracking done, the last part of our project will get that gun barrel pointing at the target, ready to start blasting!  Since the barrel is already parented to the turret (you did do this, right?) then its horizontal tracking is already done.  We simply need to track the pivot angle of the barrel to point up or down!


Barrel pivots to target This time, we select our barrel object.  Select the barrel.Rotation.P (pivot) channel.  Add in our LW_Channelfollower modifier, double click and set it up pretty much the same as we did for the turret, with the exception that this time, we are following the target's Position.Y channel instead.

As the target moves up and down, we want the barrel to pivot to match it.

Another interesting thing to note here is that I scaled the movement by negative 1000% - The barrel, when animated, was pointing in the opposite direction (ie. down, instead of up!) so using a negative number simply fixed that.

Again, this will be tweaked by yourself as necessary with your animation.

Click OK and keyframe some up/down movement in your target object.  Play the animation and tweak if necessary!

If all works out well, your gun emplacement will now lock on and track your moving target...  If this is true, then congratulations!
 

That's it!

That's all there is to using channelfollower.  Of course, there's so much more that can be done with this cool modifier, so go out and use your imagination!  Some ideas from me to get you started would be:
  • Targetting a camera to an object.  Sure, you can use 'Target' in the camera's motion settings, but with channelfollower there's the added ability to add some Time lag to make the camera movement feel more natural.
  • Locking that laser beam on that klingon cruiser! (Obvious choice for a lot of us!)
  • Character animation such as eye movement, turning or moving a character towards another item, etc.
Go out and play - learn - then write a tutorial about it!  L6 rocks! ;-)

Enjoy!
 
 

Kevin 'kevman' Phillips
This page/article Copyright© 2000 Kevin Phillips


You are Visitor since 28-April-2000

 
 

This page hosted by  Get your own Free Home Page