# Thread: How to set an object Y position according to its X distance of another one ?

1. Originally Posted by Sensei

..or you can use Math > Scalar > Clamp node like here:

Attachment 146917
It does not do anything. It only disable the whole controler.

2. Originally Posted by lasco
I need to do this crossing different axis, means that A object should have its Y value increasing when X distance value of B object (from A) will change.
To do what you said in OP, we need to extract specific axis using Tools > Vector Scalar node.
And optionally making it absolute (ignore sign) by using Math > Scalar > Abs.
Then clamp it. Then use like in previous setup.

DISTANCE MODIFIED.zip

I added Math > Vector > Multiply to cancel any Y changes in children item. You can move item in X and Z axes freely.

If difference between children and parent X axis is changing, it's clamped to range 0.5 and 1.5 (because cube item has pivot in 0.5,0.5,0.5), then used as Y input in Make Vector, then added to previous item position (just X and Z, because of Y is cleared by Math > Vector > Multiply).

Is it what you wanted?

- - - Updated - - -

Originally Posted by lasco
It does not do anything. It only disable the whole controler.
Because your parent is too far from children. Remember you're using Math > Vector > Distance node which relies on both objects to be very close each other (less than 1 meter).

3. Your modified scene works quite fine, even if I don't understand everything. Still, you noticed that the cube is free to move on Z axis but not on X. If you drag it on X it "jumps" on the left as well as on the right.

Last more thing maybe more complicated : what if I want my children to react non symetrically ? Means when the parent is at + 5 m distance on X axis the children is at Y = 0 then I drag the parent near to X = 0 so the children climbs to let's say 2 m on Y axis but if I continue to drag the parent on the same way, say to - 5 m on X axis then the children will NOT go down and will remain at its high position.

PS : again, as you advised me yesterday I purchased your plugin so maybe we could use it if it's easier (as you suggested yes I need to play the stuff with many, many children objects) ?

4. Originally Posted by lasco
PS : again, as you advised me yesterday I purchased your plugin so maybe we could use it if it's easier (as you suggested yes I need to play the stuff with many, many children objects) ?
I will send you it tonight. Right now I am way too busy. Sorry.
I will send you the first registration utility and then when I will get reply from you, I will be able to send you plugin.

- - - Updated - - -

Originally Posted by lasco
Last more thing maybe more complicated : what if I want my children to react non symetrically ? Means when the parent is at + 5 m distance on X axis the children is at Y = 0 then I drag the parent near to X = 0 so the children climbs to let's say 2 m on Y axis but if I continue to drag the parent on the same way, say to - 5 m on X axis then the children will NOT go down and will remain at its high position.
I will reread what you said, when I will be back home. But if you want non-linear, Gradient node with couple keys, and the right values of Alpha is the easiest approach. There is editable curve node inside of LW too.

5. If yours intention is to make joystick-like controllers for character you animate, why you said in the first place about calculating distance from "parent" item to "children" item.. ?
We should start from simpler case: absolute X axis of "parent" to drive "children" Y axis. Simply unplug connection from "Input" node > World Position to Vector Scalar node. And during "parent" movement in X axis, you will have reaction from "children". Also "children" will be able to freely move in X and Z axis, and not able to move in Y axis (as it's overridden by nodes).

From simpler approach to more complex approach. Step-by-step. And you will get used to and understand what you're doing.

6. If you want joystick-like null controller below or above character you want to animate,
it is not distance (Math > Vector > Distance), which should be calculated,
but difference, displacement.

To do it, you need to use Math > Vector > Subtract.
And parent "parent" item (i.e. joystick-like null controller) to "children" item in Motion Options.
So after moving "children" (i.e. character to animate), both will be moved together.

7. Originally Posted by Sensei
If you want joystick-like null controller below or above character you want to animate,
it is not distance (Math > Vector > Distance), which should be calculated,
but difference, displacement.

To do it, you need to use Math > Vector > Subtract.
And parent "parent" item (i.e. joystick-like null controller) to "children" item in Motion Options.
So after moving "children" (i.e. character to animate), both will be moved together.
It's not really joystick like controller for character that I'm trying to do.

Actually I have a building with several floors and each floor has a window blind row (around 50 window blinds each floor).
What I'm trying to get is a system allowing to open / close all the window blinds with another object that control it, according to a kind of "hola" movement.

Just like in the video below except that I need that my window blinds (cubes here) stay down when the "parent" is at far right of the screen.

8. Try Math Scalar Logic node with mode set to Greater Than.
Take control null World Position, extract X, plug to Logic node.
Second argument for logic will be X from window item.

So entire thing is doing action:
If X of null is greater than X from window position item, close or open window by moving item up or down.

Yeah. I see usage for Node Library. Waiting for system info.

9. This is scene you want:

Windows.zip

10. Originally Posted by Sensei
This is scene you want:

Windows.zip
Thank you so much Sensei… I'd never be able to figure out how to do this alone.

Eventually you did not use your Node motion plugin, did you ?

11. Btw why do you prefer to use "World Position" as output of the very first Node ? Doing this will have the whole mechanism work less if the group of objects is translated from tens or hundred meters from the center of the scene…
Just using "Position" seems more convenient…

12. World Position is absolute.
Position goes through transformation matrix of entire hierarchy of objects.
It is affected by offsetting child items, rotating, and scaling AFAIR.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•