To tweek things like that you can't move the object around. If you select the pNutConstraintGrp you can see that the attributes for translate and rotate are light blue. If you rotate the group it will snap back when you step a frame back of forward in the timeline. I created two groups earlier. A constraintGrp and an offsetGrp. We could use the offset group to rotate the nut, but we're not going to in this occasion. You see, when we create two groups like this we make sure that the top one are constrained. This group will lose it's movement possibilities, but the group below will be able to translate and rotate. If we didn't have an offset-group we would have to move the geometry itself and we don't want that.
However, this time I want to fix this little challenge by using an already built in attribute in Maya. Select the motionPath and under OUTPUTS click motionPath1. Here you can see U Value and a couple of twist attributes.If you taka a look at the U Value you can see that it's colored. This is because it's keyed to the timeline I had when I set the motionPath up. By default Maya keyes it like that.Right click it and choose Break Connections. We want to connect this value to the slider we created.
Use the twist attributes to twist the nut back into place. I had to set "upTwist" to 90. I'm going to use "Set Driven Key" to make the slider control the U Value. If you have read my tutorial on driven keys you know how this works. If not you can go read about it here.
This time neutral is not 0 for the motionPath and the cube. It will be for the cube, but when the cube is at 0 the motionPath is at 0.5 so this time my lines of MEL-code will look like this.
setDrivenKeyframe -dv 0 -v 0.5 -cd pSlider.translateZ motionPath1.uValue;
setDrivenKeyframe -dv -10 -v 1.0 -cd pSlider.translateZ motionPath1.uValue;
setDrivenKeyframe -dv 10 -v 0 -cd pSlider.translateZ motionPath1.uValue; |