Minor fix if saved editor viewport camera location gets corrupted
This commit is contained in:
@@ -207,12 +207,21 @@ namespace FlaxEditor.Viewport.Cameras
|
||||
}
|
||||
|
||||
// Animate camera
|
||||
float a = Mathf.Saturate(progress);
|
||||
a = a * a * a;
|
||||
Transform targetTransform = Transform.Lerp(_startMove, _endMove, a);
|
||||
targetTransform.Scale = Vector3.Zero;
|
||||
Viewport.ViewPosition = targetTransform.Translation;
|
||||
Viewport.ViewOrientation = targetTransform.Orientation;
|
||||
try
|
||||
{
|
||||
float a = Mathf.Saturate(progress);
|
||||
a = a * a * a;
|
||||
var targetTransform = Transform.Lerp(_startMove, _endMove, a);
|
||||
targetTransform.Scale = Vector3.Zero;
|
||||
Viewport.ViewPosition = targetTransform.Translation;
|
||||
Viewport.ViewOrientation = targetTransform.Orientation;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Fix camera if lerp failed (eg. large world with NaNs inside)
|
||||
Viewport.ViewPosition = Vector3.Zero;
|
||||
Viewport.ViewOrientation = Quaternion.Identity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user