Problem with IK constraint on bone

I am attempting to use an IK constraint to rig a crossbar on a locomotive. I’m not sure this is the best way to go about it, but a tutorial I was watching did it this way, and I wanted to follow along.

I get weird behavior, though. Whenever my wheel is rotated ~180 degrees from its default, the crossbar bone points away from its target, as opposed to towards it. Any ideas?

Additionally, is there a better way to go about rigging this?

https://i.imgur.com/Mrfcvow.gif

https://i.imgur.com/zAK1WMp.gif

That looks familiar… :wink:

What is the chain length on the IK set at? Are the axes locked in the inverse kinematics panel for all axes except x?

It looks like their is a two bone connected chain with an IK and when the wheel rotates, it has no choice but to flip. Use a single bone and an IK constraint set to 1. The target for the IK constraint should not be connected to the IK bone.

It could also be a simple parenting problem or a minor edit mode positioning issue.

These are guesses. Uploading a file would be far better and much easier for us to troubleshot and give proper advice.

Good luck!

Why hello! Fancy running into you here.

I went ahead and uploaded the file since I couldn’t make any headway: http://pasteall.org/blend/index.php?id=48260

Thanks for making a locomotive tutorial, even if it doesn’t feature the superior Walschaerts valve gear! :stuck_out_tongue:

Heya Rekov,

I’m not sure what a Walschaerts valve gear is, but I’m sure I warned everyone at the start of the series that I was not a “train nutter”, as my friend, Clockmender (who IS a train nutter) likes to call them. :stuck_out_tongue:

I have two bits of good news for you. You did nothing wrong and there is an easy fix to the flipping.

There seems to be a quirky bug in the IK constraint when it is affecting a single bone. I was able to reproduce the same flipping issue in some other files.

First, to fix the flipping, delete the IK constraint and replace it with a Damped Track instead. Done!

The Damped Track seems to be more robust and resistant to the flipping.

I’m not 100% sure that the IK flipping is/would be considered a bug. It only appears to flip the bone when the parent bone is rotated 180.4 - 180.60 degrees. (I can’t tell the exact percentage of a degree because Blender stops counting in decimals above 100 degrees.) You were (un)lucky enough that the animation on the drive wheel had the bone rotated to this weird number on a frame instead of in between frames.

Anyways, good luck from here on out. I’ll need to make an amendment to the series to explain the fix. (I have another solution as well, but it requires a bit more effort and explanation.)

When I record the amendment tutorial, I’ll post it here, if anyone else is interested.

Good luck!

Thanks DanPro, that solved it!

If you ever decide to become a train nutter, this is a walschaerts valve:

It will be interesting trying to rig that expansion joint, I think.

http://www.steamlocomotive.com/appliances/walschaerts.gif

Is there any way I can convince you to do a demonstration video on building the rig in the gif image just above? I’m working on an armature for a centaur cosplay costume and am having trouble rigging the back legs in a similar manner to test the design before building the prototype.

The IK works by picking a solution that requires the least rotations. In the case of a well set-up, single bone, it really shouldn’t twitch. But I don’t know for sure that this is well set-up, because I haven’t downloaded the file.

Getting weird behavior on these kinds of wheel structures is pretty normal, and they often require “inherit rotation” to be disabled on the start of the IK chain. If that causes problems because of potential root bone rotation, you can parent the the IK chain to the root and then copy location from a marker bone to inherit rotation from root but position from the wheel.