Camera orbit fix (#3963)
* Fix for camera look-at and position being the same when calculating orbit point Signed-off-by: hultonha <hultonha@amazon.co.uk> * add unit test to verify camera orbit behavior Signed-off-by: hultonha <hultonha@amazon.co.uk>
This commit is contained in:
@@ -588,6 +588,12 @@ namespace AzFramework
|
||||
// pass through the camera's position and look vector for use in the lookAt function
|
||||
if (const auto lookAt = lookAtFn(targetCamera.Translation(), targetCamera.Rotation().GetBasisY()))
|
||||
{
|
||||
// default to internal look at behavior if the look at point matches the camera translation
|
||||
if (targetCamera.m_lookAt.IsClose(*lookAt))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto transform = AZ::Transform::CreateLookAt(targetCamera.m_lookAt, *lookAt);
|
||||
nextCamera.m_lookDist = -lookAt->GetDistance(targetCamera.m_lookAt);
|
||||
UpdateCameraFromTransform(nextCamera, transform);
|
||||
|
||||
Reference in New Issue
Block a user