Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 2.11 KB

third_person_camera.md

File metadata and controls

54 lines (36 loc) · 2.11 KB
MagnebotController

Third-person cameras

For more information regarding TDW cameras and avatars, read this.

For more information regarding TDW camera controls, read this.

For more information regarding TDW image output data, read this.

To add a third-person camera to a scene, add a ThirdPersonCamera. A third-person camera can optionally follow the Magnebot and return images per-frame.

This controller will add a third-person camera to the scene and save images per-frame:

from tdw.add_ons.third_person_camera import ThirdPersonCamera
from tdw.add_ons.image_capture import ImageCapture
from tdw.backend.paths import EXAMPLE_CONTROLLER_OUTPUT_PATH
from magnebot import MagnebotController

c = MagnebotController()
c.init_scene()

# Create a camera and enable image capture.
camera = ThirdPersonCamera(position={"x": 2, "y": 3, "z": -1.5},
                           look_at=c.magnebot.robot_id,
                           avatar_id="a")
path = EXAMPLE_CONTROLLER_OUTPUT_PATH.joinpath("magnebot_third_person_camera")
print(f"Images will be saved to: {path}")
capture = ImageCapture(avatar_ids=["a"], path=path)
c.add_ons.extend([camera, capture])

c.move_by(3)
c.turn_by(45)
c.move_by(-2)
c.end()

Result:


Next: Occupancy maps

Return to the README


Examples controllers: