nkls
01-23-2006, 08:51 AM
Hi!
I'm kind of new to mel scripting. Anyway, I'm trying to create a simple "car rig", sliders for steering and so on. The problem I have is when trying to mix the steering control with wheel spinning.
What I'm going to do is an animation with a car moving along a motion path. Along the path, as it turns, I animate the steering by hand via my steering slider. When adding wheel spin it works fine as the car moves straight, but when it turns the wheels starts to rotate incorrect. I figurerd out that this has something to do with objectspace/worldspace rotation. But I don't understand how to write the script to get this right.
Here's the wheelSpin part of my script:
proc wheelSpin() {
//get the starting frame for spinning
int $startFrame= `textFieldGrp -q -text textStart`;
//get the stop frame
int $stopFrame= `textFieldGrp -q -text textStop`;
//counting frames
int $time = ($stopFrame - $startFrame);
//keyframe at startframe
setAttr carWheelFR.rz 0;
setKeyframe -t $startFrame carWheelFR.rz;
//keyframe at stop frame
setAttr carWheelFR.rz ($time * -50);
setKeyframe -t $stopFrame carWheelFR.rz;
}
If anyone understands my problem, please give me some advice!
Thanks in advance.
I'm kind of new to mel scripting. Anyway, I'm trying to create a simple "car rig", sliders for steering and so on. The problem I have is when trying to mix the steering control with wheel spinning.
What I'm going to do is an animation with a car moving along a motion path. Along the path, as it turns, I animate the steering by hand via my steering slider. When adding wheel spin it works fine as the car moves straight, but when it turns the wheels starts to rotate incorrect. I figurerd out that this has something to do with objectspace/worldspace rotation. But I don't understand how to write the script to get this right.
Here's the wheelSpin part of my script:
proc wheelSpin() {
//get the starting frame for spinning
int $startFrame= `textFieldGrp -q -text textStart`;
//get the stop frame
int $stopFrame= `textFieldGrp -q -text textStop`;
//counting frames
int $time = ($stopFrame - $startFrame);
//keyframe at startframe
setAttr carWheelFR.rz 0;
setKeyframe -t $startFrame carWheelFR.rz;
//keyframe at stop frame
setAttr carWheelFR.rz ($time * -50);
setKeyframe -t $stopFrame carWheelFR.rz;
}
If anyone understands my problem, please give me some advice!
Thanks in advance.
