Been toying around with some ideas of how I can rotate a cube along the X axis but rotate it where its corners are its pivots.

So that effectively it would be a rolling cube. Reason is I wanted the ability to roll it around where I choose. Ive toyed with some maths but not really come up with a nice solution yet…note Im only rotating it along the X axis, so effectively in 2d. I am always rotating it around Vector3.forward.

The problem is given any rotation that the cube is currently in I need to know what the lowest right most point given any rotation of the cube.

Maybe Im just being dumb but I cant think of a nice way of doing this?

Do you need to know the position of the lowest right most corner? Or the position of the lowest right most corner of the axis aligned bounding box?

If the position of the corner itself, I would child Transforms to each corner. Then you can just get the location of those transforms to know where the corners are.

If you want to know the corner of the axis aligned bounding box, Renderers and Colliders both have a bounds property that you can use to find the lowest right most point of the bounding box.

Yeah this is actually what I have done. I assigned some transforms to each of the corners to make things a bit easier. The problem is when it comes to rotating the cube, these will actually flip as its rotating (so everything becomes reversed).

An axis aligned bbox wont achieve what I need. I need the bottom right corner of the rotated box so that I know what pivot point to rotate around.

Do you only need to check this after the flip, I.e. when the cube is flat on the ground?

EDIT: The idea here is that there is only one corner (technically two on a cube) that is both below and to the right of the square. Again, assuming it is flat on the ground and the faces of the cube align with the axises. (axii?)

Ya, I chose that assumption because it made the problem simpler. If we can rotate the cube in any direction, we have to track all 8 corners.

Let’s consider some corner cases. (That’s a pun!)

Now, if you have a cube turned 45 degrees, you could have 4 corners that are all equally the most lower right corner. (Two corners are directly below the center, two corners directly to the right of center.)

If the cube can have any rotation, then you could have two corners that are below and right of the center. One corner can be more below than right, and the other corner could be more right than below, yet the two corners are equally the most lower right corner.

In any case, I would use a similar technique. Compare the positions of all the corners to figure out which one has the best combination of down and to the right.