Is there any method for rotating an entity around a given point? Or is there a way to set the pivot point of an object?
Imagine this scenario:
I have created a flagpole (just a stretched cube) lying on the ground. Now I want to raise half-way by rotating it 45 degrees around it’s end point. I haven’t found any rotateAround() function, so instead I am trying this:
flagpole.setLocalScale(10, 1, 1); // to make my cube flagpolish
flagpole.translate(5, 0, 0); // move it so that its end point is at world’s origin
flagpole.rotate(0, 0, 45); // rotate it around world z by 45 degrees
flagpole.translate(-5, 0, 0); // move it back
However, I still end up with a flag pole half sunken under ground. I guess it’s because ‘rotate’ does not rotate around the world’s origin. So… I guess I have to go via matrixes to achieve what I want, but isn’t there an easier way? It seems like rotateAround() is an obvious missing nice-to-have-piece.