Fix USD camera orbit pivot — use scene bbox centroid instead of focus distance
When switching to a USD camera, the orbit pivot was set from GfCamera::GetFocusDistance() which is a depth-of-field attribute that defaults to 5 scene units regardless of scene scale. InitCameraNavigation() now computes the scene bounding box centroid, projects it onto the camera view ray to get a proper orbit distance, and calls SetFocalPoint/SetDist to place the pivot correctly. Added SetDist() setter on ViewportCamera to support this. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,14 @@ public:
|
||||
m_cameraTransformDirty = true;
|
||||
}
|
||||
|
||||
/// Set the orbit distance directly.
|
||||
/// Used when initialising from a USD camera prim to override the camera's
|
||||
/// authored focus distance (which is a DOF attribute, not an orbit radius).
|
||||
void SetDist(double d) {
|
||||
m_dist = d;
|
||||
m_cameraTransformDirty = true;
|
||||
}
|
||||
|
||||
/// Returns the current near-clip distance.
|
||||
double GetNearClip() const {
|
||||
return static_cast<double>(m_camera.GetClippingRange().GetMin());
|
||||
|
||||
Reference in New Issue
Block a user