Search code examples
pythonjupyter-notebookjupyterpythreejs

For pythreejs, how do you "truck" (translate left or right) the camera with the keyboard in Jupyter?


I was wondering if there is a keyboard shortcut for translation of the origin. I can pan, tilt, and zoom with the mouse, but I would like to truck, etc. (wasd keys in most video games). If this is not possible, then that info is helpful as well.

In the threejs docs, they mention setting enableKeys as an option in OrbitControls, but I don't see that option in pythreejs:

c = PerspectiveCamera(position=[10, 10, 10])
renderer = Renderer(camera=c, background='black', background_opacity=1, scene=scene, 
                    controls=[OrbitControls(controlling=c)],
                    width=400, height=400)

Solution

  • While the standard OrbitControls should handle trucking/panning by the arrow keys, the pythreejs element on the page does not get focus, so it never receives the keyboard input.