This tutorial courtesy of Eric Poirer and XSIStationThis is my first tutorial so if you feel it's need more info please tell me
This is a tutorial to create a expression driven tank transport for a project I'm currently working on called "Code name: THX" (no relations with Lucas) I've always liked to work with expressions, Maya's expression are great BTW, so I decided to try out XSI expressions, unfortunately they are not as good as in Maya, they lake the algorithm like: if, while, for,.. but from what I've been told they will be greatly improve in the next version of XSI (v1.1 ??). Algorithmic expressions will also greatly improve XSI particle system... I hope ! On with the tutorial 1. Import you scene in XSI, in my case 80% was done in Maya, the rest is currently being done in XSI, and since this is a tutorial on expressions I'm only going to used the low rez version of CAT-17. XSI now support layers, so my suggestion is to created several layers for different part of your scene e.i. Background, Tank, Tank_details, Wheels, Treads. To created a layer click on the Layers->New layer button on top of MCA (Main Command Area). Select the object(s) you what in that layer, click the layer you what with the drop down menu, just below the Layers button in the MCA, then go to Layers->Move selection to current layer to put the object(s) in the selected layer. Maya users already knows the many advantages to having a well organist layered scene. For regular Softimage user the layer function is a vast improvement to the old hide/unhide and will greatly improve your workflow. 2. Crated a curve around your wheels, that curve will be the path that the treads will travel around the wheels and name this curve track_path_R BTW having a good naming convention is your best allied in righting expressions and scripts, try to be logical in naming objects, in my case R is Right, L is Left.3. Select the tread and rename it tread1, the 1 is important you will see why later. Make sure that the center is in the middle of the tread, click the Center button in the MCA and move the center is you have to. If you imported your objects from Maya, you will probably have to. 4. Select tread1 and click on Path->Set Path in the Animate tool bar (green colored). Then click on the curve track_path_R to select it as the path. A window for PathCns should pop up, in the Tangency tab you may have to adjust the Axis to Align to but you tread in the right position, by default it's X. BTW if you lose the window you can get it back by RIGHT click on Property->Kinematics in the MCA
5. Still in the same window, click on the Path tab then RIGHT click on the little icon beside Path Percentage and click on Remove Animation, the icon will turn back to green. 6. Still with tread1 selected click on Edit->Duplicate Multiple and enter the number of treads you need to close your track loop, in my case I needed 74 so I copied 73. It does not matter if you duplicate more, at the end just delete them. You will get 74 objects, tread1 to tread 74. 7. Create a circle curve and rename it contrl_track_R. Move the points around to create a star, this will greatly improve the visual interaction of the rotating circle. This curve will drive the treads around the path, from 0 to 100+%
8. Select tread1, then RIGHT click on Property->Kinematics in the MCA. In the Path tab RIGHT click on the Path Percentage green icon and then on Set Expression. From there there is two ways to enter the expression, the first one is to click on Object and go get the rotation of contrl_track_R, under the Kinematics->Local->Ori->Euler->X. Or, and this where your good naming convention come in to play, just type in the expression: (you may have to delete the 0.0) ( contrl_track_R.kine.local.rotx /360*100 ) + ( 1*1.351 ) contrl_track_R = The circle star kine = Kinematic rotx = Rotation in X /360 = 360 degrees in the circle *100 = x100 is to transfer the result of (rotx/360) in a Path Percentage 1*1.351 = 1.351 will change depending on the length of your tread you have model, the best way to get to a number that will work for you is to try out different numbers until you get the best result. The 1 will change depending on the object e.i tread2->2*1.351, tread3->3*1.351... + = this places the tread at the correct position on the path. tread1 = 1.351%, tread2 = 1.702%, ... 9. Once you have entered the expression: ( contrl_track_R.kine.local.rotx /360*100 ) + ( 1*1.351 ) you can click validate and then Apply. 10. Since they are 74 tracks, editing one be one every track would be long, keep in mind there is a Right and Left side, 148 treads. This is where the XSI VBscripting comes in to save the day ! The first way would be to create a script that will assign the expression to all the treads. The algorithm would go something like: I=1; space = 1.351; for I <= 74 do SetExpr "treadi.kine.pathcns.perc", "( contrl_track_R.kine.local.rotx / 360 * 100 ) + ( I * space )"; I ++; Since I'm new to VBscripting I have not tried it, I'm not sure if treadi would work in XSI. The way I did it was to copy the SetExpr line 74 times in the script editor, I change the numbers from 1 to 74, and then just do a find replace on 1.351 to test out the number in step.7 11. Now to set the expression to the wheels. Select one of the wheels, make sure that the center is position correctly, RIGHT click on Property->Kinematics, click on the Local Transform->Pose tab, RIGHT click on the Rotation X green icon->Set Expression. Again here there is two ways to enter the expression: contrl_track_R.kine.local.rotx*3.7 Again here 3.7 is a number that fits my wheel size, play with that number for your wheels so that they will be synchronize with the treads. 12. Apply this expression to all the wheels 13. Apply the same procedure for the Left side track 14. Now we will control the drive of the tank with one clear object, it's good to keep things clear because, in most cases a TD (Technical Director) will created the expressions and will pass it along to a animator. So by keeping things simple and clear it will cut time in the production pipeline, and what could be clearer that a big arrow !
15. Created a curve circle and move the points around to create a arrow. Renamed it cat_17_direction (or name_direction) Again the naming convention come in to play, it's important to have a clear picture in a scene with 100 different things going on at the same time. 16. Open the Kinematics window of contrl_track_R, under the Local Transform, Pose, Rotation X, open the Expression Editor and enter this expression: cat_17_direction.kine.global.posz*14.35 Again here 14.35 applies to my tank, to find the correct your correct number adjust it until you see that the treads don't slip as you translate the arrow in Z. 17. Finally make sure that every object is parented correctly or you will see pieces of your tank that will not move.
This tutorial courtesy of Eric Poirer and XSIStation