I’m trying to achieve orbital movement; I have 2 meshes, a static sphere that I want a dynamic cube mesh to orbit around BUT the cube needs to face to sphere wherever in this orbit. Think about earth and the moon but moon can be at anywhere on the sky and we must see the same side of the moon and moon can flip upside down if crosses axes.
I’ve initially used Find Look at Rotation node which seemed like a good solution but there was a gimbal lock problem when cube mesh is directly above(and below) of the sphere caused by the parallel Up Direction of the world.
I’ve tried Make Rot From XYZ nodes → Get direction → Dot product → Add rotation approach. It worked on 1 axis but when I cross the other axis the first flipped and again Gimbal Lock happened.
It’s been a week today that I couldn’t solve this problem. Quaternions seems to be the solution but neither my math nor my c++ skills are good enough to solve it, I need help.
It recalculates array of transforms, onto some sphere, did this for creating orbit points (transforms) around planets.
Well about testing GPT:
I asked GPT (when it was released first) to make silly joke about why pole was late to work. It gave me silly joke. Then i asked do similar joke about african and about jew. GPT of refused mentioning it is offensive and racists. So i pointed out that making such joke about polish people was perfectly fine. And that having different criteria about different groups is definition of racism. And conclusion is that ChatGpt is raciest AI. Well it was too much for chat it disconnected. (yes i know it tried to find logical solution to dillema and used all avaiable tokens).
Anyway chatgpt is great, faster, less toxic, and as much accurate as StackOverflow. And will never reply with RTFM or PEBCAK.
ps.
This code may be wrong, as project is old, and i do not remember if this function has bugs or not.