Fake Track-to Constraint with Drivers?

Is it possible to do the equivalent of a Track-to constraint using just drivers? Or something else?

In the model I’m working on, I switched to a combination of Damped Track and Locked Track to compensate for Track To’s shortcomings, but it’s still only 99% behaving the way I expect. I’m afraid I’m pushing these do-hickeys to their limits (perhaps beyond) so I’m looking into alternatives.

what is the 1% that you don’t expect?

One of the pistons (out of six) is tracking about 5 degrees off.

it’s strange that it would do that. Are you sure that there isn’t a prob with your object itself?

I’m going to check this morning. Any bets on how embarrassed my next post is going to be? :slight_smile:

Oh, and I take it there is no way to emulate Track-to with drivers.

Nope, and honestly emulating constraints with drivers is bad practice. Track-to is also broken and should be removed one of these days. Damped track-to replaced its functionality long ago.

Yup, I’m actually using Damped and Locked; the reference to Track to was more about the concept that the actual constraint.

still having the same problem? with you last piston?

I did manage to clean up most of the problem. It seems I had moved some bones in Pose Mode (I’m assuming this) before attaching the meshes, so detaching them, snapping things into their proper places, and then reattaching them went a long way toward getting things to move and track correctly.

I also made changes to anchor points for so-called target bones. Part of the problem was that the (track-to) target bone for the piston wasn’t snapped to the rotation point of the base. That helped a lot. I was trying to keep the target below the base to avoid crazy behaviour in the rig’s rest position. Turned out it wasn’t necessary for some reason although it was in the test rig I built originally to prove the concept.

But even with everything snapped into place, rotating around the correct point, etc. etc. it’s still off by one or two degrees. It’s close enough for what I’m doing, so no worries there, but if I were showing a close-up of that part of the piston for any amount of time I’d be more concerned, but since it will only be seen for a very short time in a shot where the audience’s focus will be on a character peeking under the bed, it’s no big deal.

It does have me wondering, though, how this type of thing could be made as accurate as possible.

I tried to upload the file so you could see what I’m doing, but this site doesn’t let me upload any more. Don’t know why. I doubt it’s anything to do with file size or type because some of the files I’ve tried to upload recently were ~270k and I’ve tried ZIP, Z7 and BLEND files.

Anyway, for now I guess I can say the problem is solved; it’s close enough for rock-n-roll, as they say. :slight_smile:

Thanks for the help (and it’s not the first time, I might add) mathiasA.

glad I could help! :slight_smile:

Mathias.

Oh, and I take it there is no way to emulate Track-to with drivers.

Sure you can, In my RE:ticular AddOn I have a feature which causes the particles to face the camera or any object. It is done without constraint, simply modify the rotation with math.


# TrumanBlending helps again with the matrix math.
# ------------------------------------------------
ob_reticular.rotation_mode = 'QUATERNION'
vec = ob_target.location - ob_reticular.location
try:
    quat = vec.to_track_quat(track_axis,up_axis)
    ob_reticular.delta_rotation_quaternion = quat
except:
    # Probably set to same track axis.
    pass

Very interesting, Atom. Can this be done with bones, too?

I have not done a lot of work with bones. To run a function from a driver, you have to setup a name space and make sure the script self-registers on load.