How to set camera position and target with new viewport api?

We are currently porting our service to create CGIs from the legacy viewport api to the new viewport apu to be able to render in separate windows…

The legacy api provides the methods set_camera_position and set_camera_target on a viewport window.

When I create a new viewport window with the new vieport widget api, I cannot find souch methods… how do I set the position and the loot at direction of a separate viewport?

Thank you very much

Carl

Hi Carl. You’ll want to start using omni.kit.viewport.utility. Look in the __init__.py of that package for a bunch of convenience functions. The functions you’re looking for don’t exist anymore, but you can get the prim path from the active camera and then transform the camera using Kit Commands or USD API.

import omni.kit.viewport.utility as vutil

viewport_api = vutil.get_active_viewport()
print(viewport_api.camera_path)

thank you for the help… that pointed me to the right direction.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.