0

I have a web page that is based on the following ThreeJS sample:

http://threejs.org/examples/#css3d_molecules

I create new nodes (atoms) dynamically by attaching them to existing nodes (atoms). After creating it and adding it to the scene, I want to bring the new atom/child element to the forefront using the minimum number of rotate, pan, & zoom operations needed to do so. However, although I know how to do each of those operations, I don't know how to calculate the optimal sequence based on the current position/quaternion of the node (atom) where I created it in the scene, and its new position which will be (0, 0, ). I will be animating the change from the old place in the scene to the new so I don't want to just change the new element's position/quaternion to the new value via an assignment. I want animate the change over time, performing a slice of each operation (pan/zoom/rotate) each animation frame.

Are there any ThreeJS methods to help me do this?

Robert Oschler
  • 14,153
  • 18
  • 94
  • 227

1 Answers1

1

See how to: get the global/world position of a child object to get world position of any mesh in your hierarchy. Then have your camera.lookAt() to that location.

Community
  • 1
  • 1
Flux
  • 626
  • 1
  • 6
  • 15