The rotation axis is centered on the cube's base. When it's at 0 degrees that's its axis rotation. However when it's below, the axis moves to one corner, and then the opposite happens for positive rotation.

I would like to know how I can find out and offset that would allow me to rotate the black cube around the base center and then move it to the position it would have if it rotated around the corner. So basically the V vector on the drawing.

Unless there's a better way of changing the pivot point.

]]>But at least I would consider trigonometry in this case the easiest solution although I am usually not a big fan of excessive trigonometry usage, e.g., constructing rotation matrices by hand and so on.

Cheers,

Ferdinand

I cannot help you more with the math, as such topics are out of scope of support. There is nothing special about how to construct the vector in our APIs.

You can either rotate a unit vector scaled to length, here assuming that up is the y-axis and alpha the z-axis.

```
v: c4d.Vector = c4d.Vector(0, length, 0) * c4d.utils.MatrixRotZ(alpha)
```

Or you can just scale the axis component of the global/local transform of your rectangle which is parallel with your `v`

. I am again assuming that the local up is along `y`

for your rectangle. This only works when the respective axis component is really parallel to v, but I assume that is the case here.

```
# I operate here in global space, you could also do this locally.
mg: c4d.Matrix = rectangle.GetMg() #The global transform of the rectangle.
j: c4d.Vector = mg.v2.GetNormalized() # Its normalized v2/j/y component, its "y-axis"
v: c4d.Vector = j * length
# Or in one go
v: c4d.Vector = rectangle.GetMg().v2.GetNormalized() * length
```

Cheers,

Ferdinand

I'm building a python tag to handle these cards:

cards_script_v01.mp4

Works quite well when cards are flat. But I'd like to add some thickness. At the moment when crossing the vertical I move the top object to where the pivot should be and move the inside object in the opposite direction:

cards_script_v01-thickness.mp4

I was wondering though if there might be a better way of doing it.

The image in my original post was showing the situation - rotation around the central point at the base vs rotation around the corner of the base. Sorry if I didn't make myself clear.

@ferdinand How would I construct this vector in c4d in python?

]]>Thank you for reaching out to us. This topic is out of scope of support because it is just a math question. I will answer here once, but for follow-up questions you would have to rely on the community.

Your question is ambiguous since you tell us what you want, `v`

, but not what you know/have. Your image is also a bit confusing with the red and black rectangle being slightly offset on their local horizontal axis, but I assume that has been done to make the image more readable.

I am going assume that you know the angle of your black rectangle in relation to the ground line and that you know the side length of the black rectangle.

This is then just a simple trigonometric identity. We have a point `O`

which lies on a line `ground`

and the line segment/vector `opp`

originating from it, which is half the side length of your rectangle long. `ground`

and `opp`

form a right triangle with an angle `alpha`

between them. We can therefore use the tangent relation to compute the adjacent `adj`

in this triangle whose length is identical to `v`

.

`v`

is a vector with the length `opp/tan(alpha)`

and the orientation `alpha`

in relation to the ground line.

Cheers,

Ferdinand

Even though it might be clunky, have you tried to prototype your concept in X-Presso ? or even mechanical rigging. There was a good Maxon (by Noseman) tutorial on youtube a few weeks ago. ]]>