Notifications
Clear all

[Closed] Wire Parameters Expressions

I have a vent that needs to rotate open and close when a lever slides right and left. I used the wire parameters to connect them the x position of the lever to the y rotation of the vent. This works, but the vent rotates way too many revolutions. I need it to go from 0 to 90 degrees. So I added a *.05 to the x position in the wire parameters dialog box. This works better, but it’s still not exactly 0 at one end and 90 degrees at the other. But when I try other numbers *.04, *.03 etc, the vent ends up starting at a crazy angle and it still doesn’t end up at 90 degrees.

Is there another method I should be using to accomplish this? I need to be able to set a min and max range of the rotation of the vent, along with a min and max range for the x position of the lever.

Sorry if this doesn’t make any sense, I’ve used max for years, but am very new to wiring/expressions, so I don’t know if I’m using the correct words.
Thanks!

2 Replies

…Is there another method I should be using to accomplish this? I need to be able to set a min and max range of the rotation of the vent, along with a min and max range for the x position of the lever.

I think using a reaction controller would be your simplest solution to get the relationship exactly like you want. Read up on them and the Reaction Manager in your Help files.

i would do it with Wire controller and Limit controllers:


 delete objects
 
 v = torus name:"vent" pos:[40,0,0] smooth:2 segs:24 sides:12 radius1:20 radius2:4 slice:on sliceFrom:-5 sliceTo:5 wirecolor:orange
 b = dummy name:"bar" boxsize:[10,10,10] pos:[0,0,0]
 
 bp = b[#transform][#position][2]
 vr = v[#transform][#rotation][3]
 
 paramWire.connect bp vr "degtorad(Y_Position*90./40)"
 vr.controller = float_limit enable:on lower_limit:0 lower_limit_enabled:on upper_limit:(degtorad 90) upper_limit_enabled:on 
 bp.controller = float_limit enable:on lower_limit:0 lower_limit_enabled:on upper_limit_enabled:off
 

moving the dummy in Y Position on 40 units gives me 90deg of the torus Z Rotation.
the torus limit controller limits Z rotation from 0 to 90
the dummy limit controller limits minimum Y position by 0