[Closed] scale script controller
Hello.
I need some guide / help on this.
I don’t want to use the reaction manager anymore. It is too buggy.
I want to transfer the actions to the scale script controllers.
I have a scale.script controller assigned on a scene object.
in this script i have 2 variables: a and b. (as node)
I want to do this:
if i move in local space the pos.z (positive z axis) of node “a” i want to take the node “b” with him but with a certain offset;
else if i move in local space the pos.z (negativ z axis) of the node “a” in want to node “b” to stay in the original position;
i saw that i can’t use “in coordsys local” on this. It gives errors.
I come up with this so far but it’s not correct and i am stuck:
This code works only in world coords. Here is a video to understand better: https://youtu.be/v4-_K2YWV6E
clearlistener()
$script.scale.controller = bezier_scale()
$script.scale.controller = scale_script()
ctrl = $script.scale.controller
ctrl.addNode "a" $Circle001
ctrl.addNode "b" $Circle002
ctrl.script =
"
if (a.pos.z > 1) do ( b.pos.z = ((a.pos.z) + 1))
[1, 1, 1]
"
delete objects
source = point name:#source pos:[0,0,40] wirecolor:orange
target = point name:#target pos:[20,0,10] wirecolor:green
p = source.pos.controller = position_list()
s = p.available.controller = position_script()
h = target.pos.controller = position_list()
v = h.available.controller = position_xyz()
h.setactive 2
s.addtarget "v_pos" v[#z_position]
s.addconstant "v_offset" 10.0
s.setexpression "[0,0, amax 0.0 (v_pos - v_offset)]"
this is how i would do it.
#1 the using a scale controller for anything else than scale is not a good practice
#2 the using of List controllers give you a way to work with ‘relative’ offsets instead of ‘absolute’ values
#3 use subanims instead of direct nodes transforms
Thank you for your advice and example.
I solved out with two expose helpers and i did all the work with what the helpers exposed.
I needed for a mouth rig.
This is the final result: https://youtu.be/GfWDKN1ePXk
Now i am thinking about your solution and i think this is a correct approach.
I will modify the script in the next days.
-Mihai.