pythreejs
pythreejs copied to clipboard
Track moving object with camera
Is it possible to track an animated object with a PerspectiveCamera such that it stays in view? A spotlight is able to do this using Spotlight.target = object, but I don't see any functions with camera.. lookAt() only works once, not during an ongoing animation.
I don't think there is any support for it in threejs, and I don't think it's been added here either. I do agree that it would be useful for avoiding a kernel round-trip per frame. We could either:
- Set up an
Object3Dreference that it will track. - Set a 3d vector for it to target (which can then be jslinked).
- A property that can be either (vector or object).
I'm not sure which one makes more sense.
I think the first option would make the most sense initially, because we generally will want to track an object. This is also consistent with lightsource-tracking (.target method), you give it an object reference to track.