How to rotate a 2-body system about various independent axes with body-fixed pivot points/rotation origins?

I am trying to simulate a jointed two-body system on Mathematica, consisting of these components: "Beam" and "Plate". I am constraining the system such that the beam is always fixed onto the plate, with these two components being connected by a "joint" - which I can't explicitly create in Mathematica, because it's not a 3D modeler per se. Overall, when no component has been rotated yet, the system looks like this, with the top object being the plate and the bottom object being the beam: .

**Context: **

I am using the Mathematica functions: Cuboid[{x1,y1,z1},{x2,y2,z2}], RotationTransform[angle,{axis of rotation},{pivot of rotation}] and Manipulate[Graphics3D[],{angle variable, starting angle, ending angle, angle stepping}], but even after trying many different Iterations, the code still doesn't run as I would like it to. (I have appended my code at the bottom for your reference and tinkering.)

**My end goal for the simulation: **

So, I have a few ways I want the component to rotate:

1. Beam rotates about the X axis, with the pivot being the centre of its bottom surface. The plate should move along with the beam with the same angular displacement, i.e. the plate is always fixed to the top surface of the beam , as the beam is undergoing its independent rotation.
2. Beam rotates about the X axis, with the pivot being the centre of its top surface. Since I also mentioned that the plate is always fixed to the beam, you can think of this as the beam rotating about the centre of the plate.
3. Plate rotates about the X axis about its centre. The beam does not rotate along with the plate, and stays fixed to where it was before the plate started rotating.
4. Plate rotates about the Y axis about its centre: Likewise to Point 2. Also, the beam does not rotate with the plate, so you can think of it as the plate rotating with the top surface of the beam being its pivot.

What I've tried:

I have tried arranging the order of the rotation matrices when I dot them in the Manipulate line of code, I have also been playing around with the coordinates for the axis of rotation, even putting in angle-dependent functions to update the rotation origin (but I don't think that works), but have run out of ideas. However, I may not have tried out all iterations since I have mainly changing my code in random ways and praying the new iteration works.

And of course, I have appended my Mathematica code at the bottom of this post, for your reference to visualise where I went wrong. In this specific code, the beam is not able to rotate about its "updated" coordinate where its bottom surface is at, but rather continues to rotate about the coordinates of the original bottom surface before the beam undergoes rotation.

I would really appreciate it if someone could help take a look and help me out with this, so I can figure this out and move on with my coding. Do let me know if you have any other questions. Thank you so much everyone!

**The code: **

PlateCoordinates = Cuboid[{-5, 5, 0.025}, {5, -5, -0.025}];
BeamCoordinates = Cuboid[{0.5, 0.5, 0.025}, {-0.5, -0.5, -10}];

RotationTransform[\[Theta]Plate, {1, 0, 0}, {0, 0, 0}];
RotationTransform[\[Psi]Plate, {0, 1, 0}, {0, 0, 0}]
RotationTransform[\[Psi]BeamOnPlate, {0, 1, 0}, {0, 0, 0}];
0, -10 }];

Manipulate[Graphics3D[{
(*plate*)FaceForm[Opacity[0.5, LightBrown]], EdgeForm[Black],
GeometricTransformation[PlateCoordinates,
(*beam*)FaceForm[Opacity[0.5, LightBrown]], EdgeForm[Black],
GeometricTransformation[BeamCoordinates,
Boxed -> True, Axes -> True, AxesLabel -> {"Y", "X", "Z"},
PlotRange -> {{-25, 25}, {-20, 10}, {-20,
10}}], {\[Theta]Plate, -360 Degree, 360 Degree,
0.01 Degree}, {\[Psi]Plate, -360 Degree, 360 Degree,
0.01 Degree}, {\[Psi]BeamOnPlate, -360 Degree, 360 Degree,
360 Degree, 0.01 Degree}]

• Where did you define the plate? Commented Jan 25 at 10:38
• @UlrichNeumann Oops, it seemed there was some problem with the formatting, so I've updated it. Thanks for bringing it up, and appreciate your help in looking into this. Commented Jan 25 at 10:56
• Please clarify your questions 2,...4: Is plate and beam always fixed and form a rigidbody? Commented Jan 25 at 11:17
• @UlrichNeumann Hi, the plate and beam are connected together by a "joint" - which I am unable to explicitly model, but am trying to mimick by specifying a rotation origin in the RotationTransform function. In essence, these two components - plate and beam - must continue to stay in contact with each other but are free to rotate about that joint as a pivot. Hope that clarifies! Commented Jan 25 at 12:05
• Though the two bodies might rotate independly around the length-axes of the beam??? Commented Jan 25 at 12:11

Hopefully I now understood the model.

The two bodies beam and plate are connected with a joint, which is able to rotate around the y-axis. The bottom anchor allows the anchor to rotate around x-axis.

The system of the two bodies possesses two degrees of freedom \[Theta],\[Psi]

plate = Cuboid[{-5, 5, 0.025}, {5, -5, -0.025}];
beam = Cuboid[{0.5, 0.5, 0.025}, {-0.5, -0.5, -10}];

Manipulate[
pivotB = {0, 0, -10};(* anchorpoint beam, x-axis {1,0,0} *)
trafoB =
Function[\[Theta] , RotationTransform[\[Theta], {1, 0, 0}, pivotB]];
pivotP = trafoB[\[Theta]][{0, 0, .25}];(* anchorpoint plate  *)
trafoP =
Function[\[Theta] , RotationTransform[\[Theta], {1, 0, 0}, pivotP]];
trafo\[Psi] =
Function[ \[Psi],
RotationTransform[ \[Psi], trafoB[\[Theta]][{0, 1 , 0}], pivotP]];
Graphics3D[{
Arrow[ {{0, 0, -10} - {10, 0, 0}, {0, 0, -10} + {10, 0, 0}} ],
Arrow[ {pivotP - trafoB[\[Theta]][{0, 10 , 0}],
pivotP + trafoB[\[Theta]][{0, 10, 0}]} ],
GeometricTransformation[beam, trafoB[\[Theta]]],
GeometricTransformation[
GeometricTransformation[

GeometricTransformation[plate, TranslationTransform[pivotP]]
, trafoP[\[Theta]]]
, trafo\[Psi][\[Psi]]]  },
PlotRange -> {{-20 , 20}, {-20, 20}, {-20 - 10,
20}}], {{\[Theta], -75 \[Degree]}, -Pi,  Pi,
Appearance -> "Labeled"}, {{\[Psi], 0 \[Degree]}, -Pi,  Pi,
Appearance -> "Labeled"}]


• Hello, thanks for getting back to me! I would like to clarify that the plate and beam are fixed together, but between them is a joint that allows these two components to rotate about the joint, to form various types of shapes. But they, together, form one jointed multibody. Now the issue I am facing is how to allow all these different rotations while still ensuring I can manipulate each component individually while the plate-and-beam continue to maintain contact with each other at the joint. Commented Jan 25 at 12:02
• Hi! Thank you for continuing to work on your model :) However, I would also like the beam to rotate about its bottom surface about the Y-axis Commented Jan 26 at 1:08
• That means the bottom joint has two DOFs? Commented Jan 26 at 8:47
• Yup the leg has 2 DoFs Commented Jan 26 at 15:42