@@ -135,6 +135,8 @@ namespace FlaxEditor.Viewport.Cameras
|
|||||||
float a = Mathf.Saturate(progress);
|
float a = Mathf.Saturate(progress);
|
||||||
a = a * a * a;
|
a = a * a * a;
|
||||||
var targetTransform = Transform.Lerp(_startMove, _endMove, a);
|
var targetTransform = Transform.Lerp(_startMove, _endMove, a);
|
||||||
|
if (progress >= 1.0f)
|
||||||
|
targetTransform = _endMove; // Be precise
|
||||||
targetTransform.Scale = Vector3.Zero;
|
targetTransform.Scale = Vector3.Zero;
|
||||||
Viewport.ViewPosition = targetTransform.Translation;
|
Viewport.ViewPosition = targetTransform.Translation;
|
||||||
Viewport.ViewOrientation = targetTransform.Orientation;
|
Viewport.ViewOrientation = targetTransform.Orientation;
|
||||||
|
|||||||
@@ -229,13 +229,11 @@ namespace FlaxEditor.Viewport
|
|||||||
{
|
{
|
||||||
if (Mathf.Abs(_movementSpeed - _maxMovementSpeed) < Mathf.Epsilon || Mathf.Abs(_movementSpeed - _minMovementSpeed) < Mathf.Epsilon)
|
if (Mathf.Abs(_movementSpeed - _maxMovementSpeed) < Mathf.Epsilon || Mathf.Abs(_movementSpeed - _minMovementSpeed) < Mathf.Epsilon)
|
||||||
return "{0:0.##}";
|
return "{0:0.##}";
|
||||||
|
|
||||||
if (_movementSpeed < 10.0f)
|
if (_movementSpeed < 10.0f)
|
||||||
return "{0:0.00}";
|
return "{0:0.00}";
|
||||||
else if (_movementSpeed < 100.0f)
|
if (_movementSpeed < 100.0f)
|
||||||
return "{0:0.0}";
|
return "{0:0.0}";
|
||||||
else
|
return "{0:#}";
|
||||||
return "{0:#}";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,11 +284,6 @@ namespace FlaxEditor.Viewport
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Float2 MousePositionDelta => _mouseDelta;
|
public Float2 MousePositionDelta => _mouseDelta;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Camera's pitch angle clamp range (in degrees).
|
|
||||||
/// </summary>
|
|
||||||
public Float2 CamPitchAngles = new Float2(-88, 88);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the view transform.
|
/// Gets the view transform.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -326,7 +319,7 @@ namespace FlaxEditor.Viewport
|
|||||||
get => Float3.Forward * ViewOrientation;
|
get => Float3.Forward * ViewOrientation;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var right = Float3.Cross(value, Float3.Up);
|
var right = Mathf.Abs(Float3.Dot(value, Float3.Up)) < 1.0f - Mathf.Epsilon ? Float3.Cross(value, Float3.Up) : Float3.Forward;
|
||||||
var up = Float3.Cross(right, value);
|
var up = Float3.Cross(right, value);
|
||||||
ViewOrientation = Quaternion.LookRotation(value, up);
|
ViewOrientation = Quaternion.LookRotation(value, up);
|
||||||
}
|
}
|
||||||
@@ -376,7 +369,11 @@ namespace FlaxEditor.Viewport
|
|||||||
public float Pitch
|
public float Pitch
|
||||||
{
|
{
|
||||||
get => _pitch;
|
get => _pitch;
|
||||||
set => _pitch = Mathf.Clamp(value, CamPitchAngles.X, CamPitchAngles.Y);
|
set
|
||||||
|
{
|
||||||
|
var pitchLimit = _isOrtho ? new Float2(-90, 90) : new Float2(-88, 88);
|
||||||
|
_pitch = Mathf.Clamp(value, pitchLimit.X, pitchLimit.Y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1155,8 +1152,7 @@ namespace FlaxEditor.Viewport
|
|||||||
/// <param name="orientation">The orientation.</param>
|
/// <param name="orientation">The orientation.</param>
|
||||||
protected void OrientViewport(Quaternion orientation)
|
protected void OrientViewport(Quaternion orientation)
|
||||||
{
|
{
|
||||||
var quat = orientation;
|
OrientViewport(ref orientation);
|
||||||
OrientViewport(ref quat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1367,7 +1363,7 @@ namespace FlaxEditor.Viewport
|
|||||||
{
|
{
|
||||||
var direction = ViewDirection;
|
var direction = ViewDirection;
|
||||||
var target = position + direction;
|
var target = position + direction;
|
||||||
var right = Float3.Normalize(Float3.Cross(Float3.Up, direction));
|
var right = Mathf.Abs(Float3.Dot(direction, Float3.Up)) < 1.0f - Mathf.Epsilon ? Float3.Normalize(Float3.Cross(Float3.Up, direction)) : Float3.Forward;
|
||||||
var up = Float3.Normalize(Float3.Cross(direction, right));
|
var up = Float3.Normalize(Float3.Cross(direction, right));
|
||||||
Matrix.LookAt(ref position, ref target, ref up, out result);
|
Matrix.LookAt(ref position, ref target, ref up, out result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user