[Closed] Script question: mouseMove to change a value
Hey guys…I was hoping one of you could answer a question for me. I’ve been playing around with a custom character rig that uses script controllers to automatically select and adjust other objects when selected (like I select the foot bone and move it it automatically selects the IK controller and moves it, then if I switch to rotate, it automatically selects the bone and rotates it) and it’s all been working great.
Now my tech artist buddy says I should be using event handlers/callbacks for this…but everthing seems to be working great so far without them.
The question I had though, I’ve got an object who’s rotation is locked out (ie I put a script controller on the objects rotation). Is there a way to have it so when I try to rotate that object (which will not rotate it because it’s locked out) it instead changes the value of a custom attributes slider?
I’d like to do this without creating a mouse tool and have it just work automatically on the rig (like the rest of what I’m doing does)
I noticed when I select and rotate the object (that does not rotate) the listener still returns a angleaxis value (rotate $ (angleaxis -21.5 [1,0,0])) but I don’t know how I can access that value (is it attach to the mouse?).
Seems like all I would need to do is wire that angleaxis .angle value to the custom attributes slider value?
Can anyone help?
That rotation value is not stored anywhere, I think it’s just feedback from that function, without really applying it. So I would go about creating a custom attribute on that script controller and feed that CA the rotation value, so that in the script controller you can decide what to do with that value. Something to be aware of, that value is not related to a hierarchy, so you can get lost pretty fast as to what value you are actually reading back, local/global etc.
About script controllers that should not be used to transform other objects, I remember Bobo once explained it pretty well. But that maybe before we had the new script controllers that use the reftargmaker functionality. So I’m not too sure if it’s god practice or not. One thing that could turn out wrong is if the controller for instance isn’t called on a certain frame, not updating the object in question as well. But don’t know when that can happen.
My 2 cents,
-Johan
I think what you are saying here is exactly what I want to do. I just don’t know how to access the rotation value (because it never really applies it to anything). Is there a way to access the feedback from the rotation tool function?
P.S. I did get close to what I wanted by applying a list controller rotation with a weight of 0. Then I was able to take that rotation (because it now applies it to an object) and apply it to CA slider. But it’s causing other problems so I’m still trying to figure out a solution.