Blender driver math issue

I have a question. So I got a custom property with a max value of 3. I also got two objects that I want to drive with my custom property. If the value is 0, both object is hidden. If the value is 1, then the first object appears. If the value is 2, then the first object is hidden, but the second object appears. And if the value is 3, then both object appears. The only issue is what should I do. I’m using scripted expression and I don’t know what expression I should use because I don’t know much about it. I hope someone can help me with this.

Sounds like a job for an action constraint.

The approach I would use is to use mask modifiers on the objects you want to hide. Then copy the custom property as a driver to the visibility of these mask modifiers.

Change the name of the variable to “vis” and use the following scripted expressions:

Object A visibility of mask modifier:
vis != 1 and vis != 3

Object B visibility of mask modifier:
vis != 2 and vis != 3

Here is an example file: https://pasteall.org/blend/13a550658d6f429c8d31b243207cb9db

Property is named Visibility and put on the Cogwheel. Object A is the donut, Object B is the sphere.

2 Likes

Hi,
Excellent … simple and efficient :+1:

Nice tips, it works really well.

@Endertainer007 Glad to hear it solved your problem. :slight_smile:

@FreeAccess Thanks!

1 Like