Add optional azimuth and elevation to initial free camera.
- Add `azimuth` and `elevation` to `visual.global`. - Add `mjv_defaultFreeCamera`. - Use `mjv_defaultFreeCamera` in `simulate`. PiperOrigin-RevId: 465505244 Change-Id: I61e60f14a990d4e2d220958adb75c325001978ee
This commit is contained in:
committed by
Copybara-Service
parent
5ee184ddaa
commit
b966a37855
@@ -152,6 +152,8 @@ void mj_defaultVisual(mjVisual* vis) {
|
||||
// global
|
||||
vis->global.fovy = 45;
|
||||
vis->global.ipd = 0.068;
|
||||
vis->global.azimuth = 90;
|
||||
vis->global.elevation = -45;
|
||||
vis->global.linewidth = 1.0;
|
||||
vis->global.glow = 0.3;
|
||||
vis->global.offwidth = 640;
|
||||
|
||||
@@ -241,6 +241,23 @@ void mjv_defaultCamera(mjvCamera* cam) {
|
||||
|
||||
|
||||
|
||||
// set default free camera
|
||||
void mjv_defaultFreeCamera(const mjModel* m, mjvCamera* cam) {
|
||||
memset(cam, 0, sizeof(mjvCamera));
|
||||
|
||||
cam->type = mjCAMERA_FREE;
|
||||
cam->fixedcamid = -1;
|
||||
cam->trackbodyid = -1;
|
||||
cam->lookat[0] = m->stat.center[0];
|
||||
cam->lookat[1] = m->stat.center[1];
|
||||
cam->lookat[2] = m->stat.center[2];
|
||||
cam->distance = 1.5 * m->stat.extent;
|
||||
cam->azimuth = m->vis.global.azimuth;
|
||||
cam->elevation = m->vis.global.elevation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// set default perturbation
|
||||
void mjv_defaultPerturb(mjvPerturb* pert) {
|
||||
memset(pert, 0, sizeof(mjvPerturb));
|
||||
|
||||
@@ -43,6 +43,9 @@ MJAPI void mjv_freeScene(mjvScene* scn);
|
||||
// set default visualization options
|
||||
MJAPI void mjv_defaultOption(mjvOption* vopt);
|
||||
|
||||
// set default free camera
|
||||
MJAPI void mjv_defaultFreeCamera(const mjModel* m, mjvCamera* cam);
|
||||
|
||||
// set default camera
|
||||
MJAPI void mjv_defaultCamera(mjvCamera* cam);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user