Updated shared preview fit to camera logic and viewing angle
Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
+3
-3
@@ -163,9 +163,9 @@ namespace AZ
|
||||
m_modelAsset->GetAabb().GetAsSphere(center, radius);
|
||||
}
|
||||
|
||||
const auto distance = radius + NearDist;
|
||||
const auto cameraRotation = Quaternion::CreateFromAxisAngle(Vector3::CreateAxisZ(), CameraRotationAngle);
|
||||
const auto cameraPosition = center + cameraRotation.TransformVector(Vector3(0.0f, distance, 0.0f));
|
||||
const auto distance = fabsf(radius / sinf(FieldOfView)) + NearDist;
|
||||
const auto cameraRotation = Quaternion::CreateFromAxisAngle(Vector3::CreateAxisX(), -CameraRotationAngle);
|
||||
const auto cameraPosition = center + cameraRotation.TransformVector(-Vector3::CreateAxisY() * distance);
|
||||
const auto cameraTransform = Transform::CreateLookAt(cameraPosition, center);
|
||||
m_view->SetCameraTransform(Matrix3x4::CreateFromTransform(cameraTransform));
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ namespace AZ
|
||||
static constexpr float NearDist = 0.001f;
|
||||
static constexpr float FarDist = 100.0f;
|
||||
static constexpr float FieldOfView = Constants::HalfPi;
|
||||
static constexpr float CameraRotationAngle = Constants::QuarterPi / 2.0f;
|
||||
static constexpr float CameraRotationAngle = Constants::HalfPi / 6.0f;
|
||||
|
||||
RPI::ScenePtr m_scene;
|
||||
RPI::ViewPtr m_view;
|
||||
|
||||
Reference in New Issue
Block a user