Xpresso - change position and rotation of object 2 after object 1 has been rotated


#1

Hello everybody

I’ve searched around on the internet and in this forum and I couldn’t find what I’m looking for.
Also my geometry skills range from non-existant to basic at best.

I would like to be able to rotate object 1 (pretty much in any direction) and have object 2 be placed at the same distance of object 1 (prior to rotation) but with the same rotation (not sure if my explanation makes sense, that’s why I have attached an image.)

I’m trying to achieve this in Xpresso, tried with matrix, vector etc. but as I mentioned before both my Xpresso and geometry skills are very limited.

Would much appreciate if someone could give me a hint on how to achieve this.

Thanks a lot!


#2

But Object 2 may not be a child of Object 1?


#3

Hey MighT42, yes it can be a child. Basically I also want to be able to change the distance between object 1 and object 2 via Xpresso.


#4

That’s just a simple parent/child relationship and doesn’t need Xpresso if your diagram is truly representative of what you’re trying to achieve.


#5

Thank you Infrograph, I think I know what you mean. I have updated my diagram, I would like to be able to set the distance between object 1 and object 2 via Xpresso.

So say, 200cm (Xpresso) between object 1 and object 2, when I then rotate object 1 I would like object 2 to “follow” and remain at the same distance to object1.

The parent/child works for the rotating aspect but in Xpresso I don’t know which attributes to take for the distance. When i take global position x for example the rotating part doesn work anymore… i’ve uploaded a c4d file, maybe that can help…

Also maybe so it’s simple to understand if i actually tell you what I’m trying to achieve in the long run. I’m trying to build a sort of window generator. Ideally i can then set the height, width, depth etc of the window and it will adapt all the objects (window itself, beams left, right, top and center and so on). Then idealy i need to be able to rotate the complete window (e.g. 90 degress) and all the element need to remain at the same distance angle etc.)

testfile.c4d (493.9 KB)


#6

Make obj 2 a child of obj 1 and use local x

child.c4d (498.9 KB)


#7

thank you so much for your help!!!


#8

A bit more complicated but still working example with constraints interpreted by XPresso )))
Constr.c4d (526.2 KB)