Skip to content

SceneWidget FLY view controls movement does not work #7331

@TheOfficialOzone

Description

@TheOfficialOzone

Checklist

Describe the issue

The camera controls for the SceneWidget's FLY view control are non functional.
Specifically W,A,S,D do not have any effect on the cameras position.

Steps to reproduce the bug

Run this on Windows using WSL
Full Source code:

import open3d as o3d
import open3d.visualization.gui as gui
import open3d.visualization.rendering as rendering
print(o3d.__version__)
app = gui.Application.instance
app.initialize()

window = app.create_window("FLY Mode Test", 1024, 768)
scene_widget = gui.SceneWidget()
window.add_child(scene_widget)

scene_widget.scene = rendering.Open3DScene(window.renderer)
scene_widget.set_view_controls(gui.SceneWidget.Controls.FLY)
window.set_focus_widget(scene_widget)

def key_callback(event):
    print(f"Key: {event.key}")
    if event.key in [gui.KeyName.W, gui.KeyName.A, gui.KeyName.S, gui.KeyName.D]:
        return gui.SceneWidget.EventCallbackResult.IGNORED
    return gui.SceneWidget.EventCallbackResult.IGNORED

scene_widget.set_on_key(key_callback)

# Create and add a mesh
mesh = o3d.geometry.TriangleMesh.create_box()
mesh.compute_vertex_normals()
scene_widget.scene.add_geometry("box", mesh, rendering.MaterialRecord())

# Frame the camera to view the mesh
bounds = mesh.get_axis_aligned_bounding_box()
scene_widget.scene.camera.look_at(
    bounds.get_center(),
    bounds.get_center() + [0, 0, 3],  # Camera position
    [0, 1, 0]                         # Up direction
)

app.run()

Error message

No error message, just notice the the camera does not move.

Expected behavior

The Camera should move with the WASD movement

Open3D, Python and System information

- Operating system: Windows 10 64-bit --> WSL
- Python version: Python 3.12.3
- Open3D version: 0.19.0
- System architecture: x86
- Is this a remote workstation?: No
- How did you install Open3D: pip
- Compiler version (if built from source): N/A

Additional information

The Mouse controls and E & D keys function properly

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot a build issue, this is likely a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions