Even though I have been working with vector graphics for over 13 years now, I still find it challenging to grasp how three.js handles things. One thing I am trying to achieve is having an object that always faces the camera and rotates accordingly.
In another programming language, I was able to achieve this using the following code snippet:
// Create a vector pointing towards the camera.
temp.x = 0;
temp.y = 1;
temp.z = 0;
vec_rotate(temp, camera.pan);
// Apply the direction of the vector to the scene object.
vec_to_angle(entity.pan, temp);
// Rotate the scene object's angle around another angle or an imaginary line from the camera to the object.
ang_rotate(
entity.pan,
vector(random(360), 0, 0)
);
However, despite using entity.lookAt(camera.position), I am still missing an angle rotation based on the current angle as shown in the last function call of the example.