I'm trying to create four buttons (represented on the image below by the four bones). The bones are constrained in their local Y axis between 0 (corresponding to the "unpressed" position) and -1 (corresponding to the "pressed" position). One button always has to be pressed, and there can only be one pressed button at a time. Whenever a button is pressed, whichever button that was in a pressed position goes back to its unpressed position. Is there a way to create this simple rig without causing a loop dependency? I tried with intermediary bones, drivers, action constraints, nothing seems to work...
1 Answer
You do it by creating a fifth entity, probably a new, non-deforming bone, to control those four bones.
Once you have a controller, there are any number of ways to have the controller affect the button bones. As an example, let's consider using drivers. Here, we'd create a driver for the Y position of each of our four button bones, from the X location of controller, that is a scripted expression. Those four scripted expressions would be:
- loc<=0
- (loc>0) and (loc<=1)
- (loc>1) and (loc<=2)
- (loc>2)
You will want to delete any existing constraints or drivers on the four button bones beforehand.
-
$\begingroup$ Thank you very much Nathan, your suggestion helped immensely. The only problem is that the controller makes the buttons be pressed in order (button 1, then button 2, etc). Do you know of a way that would allow for any button to be pressed at any time? For example, if button 1 is in a pressed position, I would be able to press button 3 without having to press button 2. Also (but this is nitpicking) is there a scripted expression that allows for the buttons to be pressed progressively, instead of directly snapping into position? $\endgroup$ Commented Oct 25, 2021 at 18:25
-
$\begingroup$ @CarlosCortesMendez "the controller makes the buttons be pressed in order" Use constant interpolation on your controller's fcurves. "pressed progressively, instead of directly snapping" Afraid I don't understand the question. $\endgroup$– NathanCommented Oct 25, 2021 at 18:49