Mujoco C++: Point the camera to another point
By default, the Mujoco camera points to (0,0,0)
. To change the camera’s target point, you can modify the lookat
property of the camera object. Here’s an example of how to point the camera to (0,0,0.5)
instead (slightly higher than the default):
mjvCamera cam;
// Init visualization structures
mjv_defaultCamera(&cam);
// Set camera lookat point
cam.lookat[0] = 0.0;
cam.lookat[1] = 0.0;
cam.lookat[2] = 0.5;
This code snippet sets the camera’s lookat point to the desired coordinates. You can adjust the values to point the camera to any other point in the scene.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow