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

Focusing point with camera #133

Open
kingjin94 opened this issue Feb 24, 2023 · 5 comments
Open

Focusing point with camera #133

kingjin94 opened this issue Feb 24, 2023 · 5 comments

Comments

@kingjin94
Copy link

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?

@ManifoldFR
Copy link
Contributor

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

@kingjin94
Copy link
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?

@ManifoldFR
Copy link
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?

@GianniLunardi
Copy link

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.

@zimmerman-pliant
Copy link

zimmerman-pliant commented Jun 13, 2024

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants