Replaying Camera Movements
This tutorial shows you how to programmatically control the camera using previously recorded camera movements. This is the companion tutorial to Recording Camera Movements.
This tutorial will teach you how to:
- Load recorded camera movement data from a pickle file
- Set up a scene with 3D objects (box, plane, sphere)
- Animate the camera by replaying the recorded trajectory
- (Optional) Capture rendered frames from the virtual camera
Prerequisites: Run the Recording Camera Movements tutorial first to generate the assets/camera_movement.pkl file.
Step 1: Load the Recorded Camera Matrices
First, we load the camera matrices that were saved in the previous tutorial. Each matrix represents a camera pose (position + orientation) at a point in time.
Step 2: Create the Scene with 3D Objects
We set up a scene with some objects to observe as the camera moves:
- A
Boxin the center - A
Planeas the ground - A
Spherethat bounces up and down (for visual interest)
The CameraView component represents our virtual camera with showFrustum=True to visualize the camera's field of view.
Step 3: Capture Rendered Frames
You can also capture the frames rendered by the virtual camera. This is useful for generating datasets or recording videos. The handler receives CAMERA_VIEW events containing the rendered frame as a buffer.
Step 4: Running the Tutorial
Paste the code into move_camera.py and run:
Open the URL printed in the terminal (usually https://vuer.ai).
You should see the camera automatically moving through the recorded trajectory, while a sphere bounces in the scene. The camera frustum visualization shows where the virtual camera is looking.