yomotsu / camera-controls

A camera control for three.js, similar to THREE.OrbitControls yet supports smooth transitions and more features.
https://yomotsu.github.io/camera-controls/
MIT License
1.89k stars 241 forks source link

Bugfix for incorrect "lookInDirectionOf" behaviour when camera orbit target is not at origin #478

Closed wellcaffeinated closed 5 months ago

wellcaffeinated commented 5 months ago

Reproduction/demonstration of the bug: https://jsfiddle.net/wellcaffeinated/zdb05n2u/

Correctly works when orbit target (green box) is at origin. But when moved (elevate), the look direction is improperly calculated.

This fixes the problem with the vector math.

yomotsu commented 5 months ago

Thanks for your report and PR. Let me merge this!