I've read the answer to the Three JS Pivot point question and it works okay. But what I'm trying to accomplish involves also the object to rotate based on the pivot rotation.
Let's say for instance that I have an object red that acts as a pivot for the little object blue. As soon as the red object moves or rotates, the blue object will move and rotate accordingly but keeping the distance between red and blue.
For simplicity in the following image we're only in the situation in which the red object rotates only.
The signature of the function answered in the other question is the following:
function rotateAboutPoint(obj, point, axis, theta, pointIsWorld)
I don't understand how do I get the axis and theta values starting from the red object rotation.
Or if that function doesn't fit this case, I'm open for other solutions.
I know that if I add the blue object as a child of the red one everything will fall in place, but I need the two objects (red and blue) to be independent from each other.
To complicate things more I'm not rotating the red object directly, but I'm using ammo.js to apply force and torque on it as a dynamic body, but I guess that I can still know its rotation by using red.rotation