I’ve searched and searched, but I can’t find this particular situation addressed anywhere. I am trying to make a level design tool for a physics based game. The purpose of the tool is to form a platform, one section at a time. I’m using a simple cube with a scale of (1f, 0.25f, 1f), so essentially a rectangle. I want to be able to specify straight, 45 degrees or 90 degrees, along with left or right and up or down to tell the engine to place the next segment on the left or right of the current segment; going upward, downward or straight out. I want to get the sides to ‘attach’ by affixing the outer corners.
For example, if the current block is lying flat (no rotation) and the next block is to be placed on the right at 45 degrees down, the upper left corner of the new block should be at the same position as the upper right corner of the current block. Assuming the next block should again be laid flat, then the lower left corner of the new block should align with the lower right corner of the 45 degrees block (see the picture below). I’m SURE there is some cool function that will tell me where the corners are, even when rotated (the Mesh.vertices returns all of the points, but not rotated in world space), but I can’t find it or an algorithm that will help.
A screen capture of what I am trying to accomplish is below. Can anyone provide some guidance or a better way to procedurally create platforms in a level? This is a physics game, not a platformer, just to reiterate.
Thanks in advance!