Skip to content

Focusing point with camera #133

Open

Description

@kingjin94

When generating more complex scenes I would like to guide the user's view to the most important elements.

The demos suggest using

viz.viewer["/Cameras/default"].set_transform(<Some 4x4 matrix>))
viz.viewer["/Cameras/default/rotated/<object>"].set_property("position", [x, y, z])

How do you use these to move the camera close to an arbitrary position, such as (10., 0., 0.) and look at this arbitrary position?

The set_property seems to be able to reposition the camera (in the three js system where "up" = z_meshcat = +y_three_js and z_three_js = -y_meshcat). The camera seems to keep focusing on the origin. How to do you change the position the camera points at and pans around?

Activity

  1. ManifoldFR commented on Feb 24, 2023

    @ManifoldFR
    Contributor

    Hi @kingjin94 ! I have an open PR about this: #109

  2. kingjin94 commented on Feb 24, 2023

    @kingjin94
    Author

    Great to hear that it is not just a problem of understanding the available API 😅 Is there any way I could help to expedite this PR?

  3. ManifoldFR commented on Mar 17, 2023

    @ManifoldFR
    Contributor

    Great to hear that it is not just a problem of understanding the available API sweat_smile Is there any way I could help to expedite this PR?

    I'm not sure. The maintainer seems very busy and maybe would like some help to look at PRs and merge them.

    @rdeits, are you open to onboarding some folks to help maintain meshcat?

  4. GianniLunardi commented on May 8, 2024

    @GianniLunardi

    Hi all,

    I see that the pull request #109 has been merged. But in my code if do something like:

    viz = pin.visualize.MeshcatVisualizer(rmodel, collision, visual)
    viz.initViewer(loadModel=True, open=True)
    viz.setCameraPosition(np.array([0.6, 0., -0.15]))
    viz.setCameraTarget(np.array([0., 1, 0.]))
    

    then setCameraTarget does not change anything and the camera keep focusing on the origin. Am I doing something wrong or the problem is still existing?
    I have installed the last versione from source.

  5. zimmerman-pliant commented on Jun 13, 2024

    @zimmerman-pliant

    It's set_cam_target() and set_cam_pos(), see here.

    Working well for me installed from source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions