Trying to rig a vehicle to transform linear motion into rotational motion for wheels

I have a four wheel vehicle that I am trying to animate moving along the ground. I have been able to convert horizontal linear motion into rotational motion for the wheels, and it works fine as long as I move the vehicle in a straight line.

The problem comes when I put the vehicle on a path, in this case a circle. As the vehicle moves away from the starting point and approached the 90 degree point, the rotation of the wheels slows, then on the far side of the circle, it runs in reverse until it gets to the 270 degree point, then slowly reverts back to forward motion.

Is there anyone who knows the secret magical incantation to make this work?

I have taken the original model (currently a bit over 10 MB) and reduced it by removing a bunch of detail, etc to create a much smaller blend file which I present here in case anyone wants to look at it.
track-test.blend (1.58 MB)
Here is a screen capture.


The large greenish horizontal bone in the picture is the root bone and the greenish bone aligned with the gear is the crank bone which has a transform constraint to the root bone. The yellowish bone has an IK constraint to a bone extended from the crank bone to move the lever. There are two bones (one for each axle) which are constrained to the crank bone.

The file has four key frames to move the handcar along the path.

The camera has a track-to constraint to follow the handcar moving around the circular track.

I built the original model according to plans which are measured with imperial units and the file is in imperial units mode. The wheels are 10 inch radius, so 2 * pi (3.14159) * r = 62.8318 inch circumference = 1 yd 2.2 feet = 1.595928 blender units.

The gear to pinion ratio is 4:1 so the circumference of the wheels drives the gear 90 degrees which in turn drives the axle and wheels 360 degrees, so it all works out mathematically.

well, the problem here is the local y position of the root bone. i have taken a look at the pose bone matrix as i show in the image below. the y position falls until a quarter of the curve, and then raise until 180, and so on.


So the question is, how do you fix it?

I am having basically the same problem with my scene, and have not been able to get around it. This is a completely different rig, but the problem is the same. Wheel rotations are correct when at a zeroed (0,0,0) position, but the further you get from that, the worse it gets. Hopefully jstapes doesn’t mind if I put another scene in here, but I think it is the same problem.

in my rig, I’m using a driver on each of the wheels, and everything is controlled by the red ring. (move on local X, or rotate on Z) This rig works for whichever direction the vehicle drives (does not need to be along a world axis), but it breaks when the vehicle rotates away from the origin.

Attachments

rigTest.blend (93.4 KB)

I don’t mind if you put your similar question in with mine. It’s a free bump. And yeah, the question is, how do you fix it?

Hi

both are really cool rigs.

Attached a file on how i approached this. In the end i went for the good old bake approach. It’s not quite auto-drive.

Seeing as the end result I’m after is an animation I used these steps.

Make all your animation with the vehicle where you want it .
Run a script that bakes the displacement of each wheel to a custom property.
The same script can also bake velocity and acceleration etc to custom properties too.
Drivers on the wheels use these created props as targets.

You could set up these drivers directly looking at the fcurves. (make a driver method and add it to the driver namespace) This is the street I went down for a while… in the end i surrendered and went for the bake approach.

Attachments

CurveDriver.blend (655 KB)

@batFINGER

Thank you for looking at the rigs and offering input.

I downloaded your blend and will look at it relatively soon. I hope that I will be able to understand it. At the moment, I am writing up documentation for my model so I can upload it to BlendSwap.

Thanks from me as well. I still have not had a chance to fully figure out how the script works, but I understand what you are doing.

I’d love it to just be able to work in the viewports, but since I am only looking for an end result this would also do just fine.

Thanks again,… and if anyone has a better solution to the above rigs please post it!