Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix camera looking back to the origin after calling move_camera() #3920

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

falkoschindler
Copy link
Contributor

This PR fixes a problem introduced by PR #3544: The camera kept looking at the origin when calling move_camera() with given look_at_* coordinates.

The fix can be verified with the following snippet. Moving back and forth between the spheres should not point the camera back to the origin, an the orbit controls should orbit around the sphere which is currently looked at:

with ui.scene() as scene:
    scene.sphere().move(1, 2, 0).material('blue')
    scene.sphere().move(4, 5, 0).material('red')

ui.button('blue', on_click=lambda: scene.move_camera(*(1, 2, 3), *(1, 2, 0), *(0, 1, 0), duration=1))
ui.button('red', on_click=lambda: scene.move_camera(*(4, 5, 6), *(4, 5, 0), *(0, 1, 0), duration=0))

@falkoschindler falkoschindler added the bug Something isn't working label Oct 25, 2024
@falkoschindler falkoschindler added this to the 2.5 milestone Oct 25, 2024
Copy link

@pascalzauberzeug pascalzauberzeug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thank you

@falkoschindler falkoschindler merged commit 5f9b3ff into main Oct 25, 2024
7 checks passed
@falkoschindler falkoschindler deleted the scene-lookat branch October 25, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants