I have two cubes where one is static and another moves freely.
The point of the program is to move a cube by a random increment (for the X and Z coordinates) till they reach the ideal distance and ideal angle (10 units and 45 degrees) and they’re supposed to move and rotate only along the XZ Axis (The camera is orthographic pointing downwards along the Y axis).
Right now I have the moving part of it figured out and working perfectly.
The only thing I have a problem with is the rotating part.
I tried moving the cube relatively to the static cube but when I do that, the moving cube pivots around the static cube instead of rotating in its place to an angle such that it makes a 45 degree angle with the static cube. I did the above using:
transform.RotateAround(staticCube.transform.position, Vector3.up, 45); and it does not work.
Any ideas on how I can do this?