Hello, any one have any ideas? I’ve managed to solve for Z rotation, but when attempting to do rotation in X, it produces weird rotation results. The code I have for getting the angles is
double* point1 = this->GetCurrentRenderer()->GetActiveCamera()->GetPosition();
double* point2 = this->cylinderActor->GetPosition();
// Find x and z angle
double XY = atan2(point2[1] - point1[1], point2[0] - point1[0]) * 180 / M_PI;
double ZY = atan2(point2[2] - point1[2], point2[1] - point1[1]) * 180 / M_PI;
double ZX = atan2(point2[2] - point1[2], point2[0] - point1[0]) * 180 / M_PI;
double orient[3] = { 0, 0, XY - 90 }; // TODO: How to solve for X rotation?
this->cylinderActor->SetOrientation(orient);
If I set the X orientation to anything, even an arbitrary angle, the orientation is wrong. I have tried using the ZY and ZX angles above but they don’t give a workable result.
Any help is appreciated!