jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
936 stars 185 forks source link

Track moving object with camera #263

Open Boomer91 opened 5 years ago

Boomer91 commented 5 years ago

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.

vidartf commented 5 years ago

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:

I'm not sure which one makes more sense.

Boomer91 commented 5 years ago

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.