Hi Guys, I’m looking to rotate my cuboid around a pivot point. I was wondering how to do this (as shown in image(green is the pivot point)) so it rotates around the pivot point and also stops at the 90 degrees. I’m also looking to find a way to do it without setting a gameobject as a child because it will be difficult when I start adding more axis.

I suppose you could move all of the vertexes of the mesh so that that corner is the origin in model space. Then when you rotated the transform it would rotate around that point.

It would get dicey if you want to rotate around multiple axes though.

You could also do the math and figure out the series of positions and rotations necessary to frame-by-frame “fake” a rotation like this. So the object itself would still rotate around it’s center, but you’d move it each time you rotate so that it would appear to rotate around that pivot.

Without knowing your use case it’s hard to tell what’s the best option.

You can use either Transform.RotateAround(), or Quaternion.AngleAxis() to do an angle/axis rotation. You specify the point (i.e. the corner of the cube) and the axis (i.e. the edge) to rotate around. With a cuboid, both are easy to calculate especially if you keep the cube axis aligned. Note the direction of the axis of rotation vector matters.