mirror of
https://github.com/DCFApixels/Unity-DebugX.git
synced 2025-09-19 02:24:36 +08:00
fix building bugs
This commit is contained in:
parent
396537731e
commit
195acca03e
@ -196,14 +196,17 @@ namespace DCFApixels
|
||||
}
|
||||
private static float GetCameraZoom(Camera camera, Vector3 position)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
position = Handles.matrix.MultiplyPoint(position);
|
||||
#endif
|
||||
Transform transform = camera.transform;
|
||||
Vector3 position2 = transform.position;
|
||||
float z = Vector3.Dot(position - position2, transform.TransformDirection(new Vector3(0f, 0f, 1f)));
|
||||
Vector3 vector = camera.WorldToScreenPoint(position2 + transform.TransformDirection(new Vector3(0f, 0f, z)));
|
||||
Vector3 vector2 = camera.WorldToScreenPoint(position2 + transform.TransformDirection(new Vector3(1f, 0f, z)));
|
||||
float magnitude = (vector - vector2).magnitude;
|
||||
return 80f / Mathf.Max(magnitude, 0.0001f) * EditorGUIUtility.pixelsPerPoint;
|
||||
//return 80f / Mathf.Max(magnitude, 0.0001f) * EditorGUIUtility.pixelsPerPoint;
|
||||
return 80f / Mathf.Max(magnitude, 0.0001f);
|
||||
|
||||
|
||||
//const float DEFAULT_ZOOM = 1f;
|
||||
|
Loading…
Reference in New Issue
Block a user