Drive a shape key based on the distance between two points?

I’ve been looking through the site, and there doesn’t seem to be a simple way to drive a shape key by the distance between two points. Most include use of geo nodes, which is fine but I’d really like to know if there’s simply a bit of code I could use in a shape key driver that would deliver a value based on the distance of (for example) one empty to another.

Surely there’s a way to do this? I’m just beginning my investigation, would really appreciate any guidance. Thanks!

Yes, use the distance option in the driver:

2 Likes

Add a Driver to the ‘Value’ property of your key, and in the Driver panel, set your Input Variable to be of type ‘Distance’, and pick the two objects that will define your ‘points’ (two Empties, for example).

Note that the distance will be in Blender units, so you might want to scale/limit your variable in the ‘Expression’ input, so it fits in the range 0 to 1.
drivers

DNorman beat me! :slight_smile:

2 Likes

Snap! …and more words

Okay, I’m putting the Dunce Cap on. This is a gigantic duh! moment for me. I didn’t look in the variable types. There’s also a rotational difference. Everything I needed was right under my nose. So:

DUH.

Thank you very much, my friends.

1 Like