Notifications
Clear all

[Closed] liniking one parameter to two controlers

I have to influence Path Constraint.controller.PERCENT – parameter, about of movement form x or y/ or x &y position from another object so If I move object “A” then object “B” will react by moving along path proportionally fast to movement of object “A”. I can`t wire it to param because this is uncompatibile to bind float to pont3 but my idea it something like this:

$.post.controller.Path Constraint.controller.PERCENT = ($box.pos.controller.Position_XYZ.controller.X_Position.controller +
$box.pos.controller.Position_XYZ.controller.Y_Position.controller)
Is there any way to achieve something like this by wireparameters or scripted controler/ms?

6 Replies

Sure, just add a script controller to “$.post.controller.Path Constraint.controller”, then add the “$box.pos.controller.Position_XYZ.controller.X_Pos ition.controller” and “$box.pos.controller.Position_XYZ.controller.Y_Posi tion.controller” tracks/controllers to the script controller as variables. Then simply add those variables up in the script field.

Though for something this simple I’d use an expression controller instead. Works about the same, but slightly better performance.

There’s a way to do it in param wiring, but that would be just evil…

Thx, I did like you said, I associated controllers with track and variables so my final expression was
“(nodeA_Xpos+nodeA_Ypos)/30”
30 is because speed is to fast. It seems it work fine but unfortunately after whale I noticed its not working correctly. When I move my control Object up & down or left & right the value is correct but when I move my object at an angle of about 45° but only on north-west to sout-hwest or sout-hwest to north-west value way less increse or even go back a little. Before I post my problem here I try this same with expose trim to get this same effect using distance between two object but there was similar problem so I tough maybe I need different approach. I also try diffrent expression like (nodeA_Xpos-nodeA_Ypos) or (nodeA_Xpos*nodeA_Ypos) but always this same resoult, is this problem with max logic or Im doing somthing wrong?

The values for position axis are always in parent space, there is no such thing as local axis value. So when you rotate the object 45 degrees and move it, only 70,7% of the value ends up in the axis that you use for the script/expression controller. If you turn it 90 degrees, 0% value will end up in the axis you use in the controller.

You could get what you want by rotating the parent instead of the object and then moving the object along its axis. A more convenient way would be to make another point between the object and the parent (object linked to point, point to parent), freeze rotations of both object and point, then instance the “Zero Euler XYZ” track from the object to the point (using the track view, RMB on the track to copy, RMB on another track to paste, pick instance), and set the object’s “Zero Euler XYZ” weight in the rotation list to 0. That way when you rotate the object you will actually rotate its parent point instead, so the parent axis will stay fixed to the object.

Great thanks for help but after one day of struggling with this I`m out.

Is really late so excuse my the way I write but I tred to follow your steps and I have to say that I dont understand whole concept inspite
I read it many times and did what you wrote .However I could make some mistakes because I was no`t
sure what is the parent, object etc in your procedure.

Just one more time for sure, my problem look like this:

I have object “A” which is my master, now I have to depend Object “B” – Path Constraint.controller.PERCENT – parameter on position of object “A”,which
object “B” move along spline – and spline is object “C”

I know then under some angles value x.axis is incresing and y.axis decrising so result is 0 or alomost 0

So according to your method “You could get what you want by rotating the parent instead of the object” – ARE YOU TALKING ABOUT OBJ A,B or C?

I rotated Object A but it don`t changed broken axis.

Could you link max scene or just simple picture with scheme or strictly explane
what is object, what is parent – parent in therm of A B C. Should
these objects have still position float script controllers?
I would be very gratefull I you could explain it because this is last thing I need to end this rig. Or maybe there is other way to do it?

below video with scheme of my scene in simplification .
https://www.youtube.com/watch?v=6-miA8pqnzk&feature=youtu.be

Neither of them. An object’s parent is what the object is linked/parented to. If it’s not linked to anything, the object’s parent is the world space, and A’s position tracks reflect values in the world space axis.

Apparently I had a different idea of what you were going for. I don’t quite understand what is it you’re trying to achieve, but at least now I can tell why it’s not working: when you move A 50.0 units in Y axis and -50.0 units in X axis, the result is: -50.0 + 50.0 = 0.0, that’s almost the case with your bottom-left to top-right red line in that video. If you move it 50.0 in Y and 50.0 in X, you get 100.0, that’s the case of your bottom-right to top-right line.

It would help if you described how you want the whole system to work. What should B do when you move A around? Do you want the path constraint % to reflect how far A is from the center? Get distance (maxscript has a length <vector> function: length [1, 1, 1] == 1.73205, if you freeze A’s transforms, you can simply use the Zero pos track for this.). Do you want to get the absolute values of X and Y? Maxscript has an abs <number> function: abs -10.0 == 10.0 . Something else? Please describe how you want it to work.

So I builded rig which work in realtime, I have legs of my crab linked to path, the faster you move crab the faster he shuld move his legs
in direction of master movement – mster is basically object with drive whole rig.
so in other words
If I move master forward, object which drive leg should move along path in tempo of moving master forward, when I move master backward then
object should move along path in spped of moved of master in backward direction. Whatever I use I always filed to translate
movement speed and direction to path.percentage offset because of different values x and y. So I need to translate Object “A” movemant direction
and speed to $.pos.controller.Path_Constraint.controller.percentag

I made simple movie to show you rig mekanizm. I used Lenght vector fn:
$Sphere001.pos.controller.Path_Constraint.controller.percentage =
(length [$box001.pos.controler.X Position, $box001.pos.controler.Y Position])/100

here is movie:
https://youtu.be/ZoawWn10Ho0

but in this case there is this same problem
but for change not along whole axis but only in some ares of this axis also object change trajectory. When I reset transform
and use it as coordinate x.y for path percentage object change position when reach this zero point.

Please take a look on my movie maybe you will get some ideas how to solw it because I have no more ideas.
I event tried to use object speed as position but don`t work with animation mode, hovever work without animation
only in realtime.

I dont know how to get speed of object in realtime so I use scripted spring object which work fantastic but unfortunately
give me 0 value about speed in animation mode or when animation keys are created.