Skip to content

Add set_chase_camera! helper function for 3rd-person object tracking … - #278

Open
rainerrodrigues wants to merge 1 commit into
rdeits:masterfrom
rainerrodrigues:feature-camera-tracker
Open

Add set_chase_camera! helper function for 3rd-person object tracking …#278
rainerrodrigues wants to merge 1 commit into
rdeits:masterfrom
rainerrodrigues:feature-camera-tracker

Conversation

@rainerrodrigues

Copy link
Copy Markdown

Description

This PR addresses the highly requested features from Issue #116 (Camera that follows the object) and Issue #205.

While MeshCat supports Trackball controls to look at an object, there hasn't been a built-in Julia-side way to physically lock the camera's position to a moving target (like a 3rd-person chase camera for drones or robotic end-effectors).

This PR introduces set_chase_camera!, a lightweight helper function that composes a target's transformation matrix with a user-defined camera offset, and applies it directly to the vis["/Cameras/default"] path.

Example Usage inside a simulation loop:

# Move the drone
drone_tform = Translation(x, y, z)  LinearMap(RotZ(heading))
settransform!(vis[:drone], drone_tform)

# Lock the camera 4 units behind and 2 units above the drone
set_chase_camera!(vis, drone_tform, offset=Translation(-4.0, 0.0, 2.0))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant