forked from 1b-agent/opencadstudio-upstream
fix: correct yaw recovery from view_direction vector
view_dir = rotation * Z = (sin(yaw)*cos(pitch), -cos(yaw)*cos(pitch), sin(pitch)) so yaw = atan2(x, -y), not atan2(x, y). The sign error caused a 180-degree Z rotation on every save/reload cycle. Applies to apply_active_vport_camera, apply_sheet_viewport_camera, and camera_for_viewport. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
05dd23a8dc
commit
35e487934c
1 file changed
+3
-3
+3
-3
@@ -2400,7 +2400,7 @@ impl Scene {
|
||||
.normalize_or(glam::Vec3::Z);
|
||||
|
||||
let pitch = vd.z.clamp(-0.999, 0.999).asin();
|
||||
let yaw = vd.x.atan2(vd.y);
|
||||
let yaw = vd.x.atan2(-vd.y);
|
||||
let rotation = camera::yaw_pitch_to_quat(yaw, pitch);
|
||||
let view_right = rotation * glam::Vec3::X;
|
||||
let view_up = rotation * glam::Vec3::Y;
|
||||
@@ -2463,7 +2463,7 @@ impl Scene {
|
||||
.normalize_or(glam::Vec3::Z);
|
||||
|
||||
let pitch = vd.z.clamp(-0.999, 0.999).asin();
|
||||
let yaw = vd.x.atan2(vd.y);
|
||||
let yaw = vd.x.atan2(-vd.y);
|
||||
let rotation = camera::yaw_pitch_to_quat(yaw, pitch);
|
||||
let view_right = rotation * glam::Vec3::X;
|
||||
let view_up = rotation * glam::Vec3::Y;
|
||||
@@ -2721,7 +2721,7 @@ impl Scene {
|
||||
.normalize_or(glam::Vec3::Z);
|
||||
|
||||
let pitch = vd.z.clamp(-0.999, 0.999).asin();
|
||||
let yaw = vd.x.atan2(vd.y);
|
||||
let yaw = vd.x.atan2(-vd.y);
|
||||
|
||||
let rotation = camera::yaw_pitch_to_quat(yaw, pitch);
|
||||
let view_right = rotation * glam::Vec3::X;
|
||||
|
||||
Reference in new issue
Block a user