This commit is contained in:
何嘉峣 2026-03-20 13:34:31 +08:00
parent 0806b4180f
commit 93ebc2f7a4
1 changed files with 7 additions and 6 deletions

View File

@ -147,16 +147,16 @@ public class RawImageModelViewer : MonoBehaviour
Bounds bounds = CalculateBounds(displayedModel); Bounds bounds = CalculateBounds(displayedModel);
modelCenter = bounds.center; modelCenter = bounds.center;
float objectSize = Mathf.Max(modelCenter.x, modelCenter.y, modelCenter.z); /*float objectSize = Mathf.Max(modelCenter.x, modelCenter.y, modelCenter.z);
targetDistance = objectSize * 1.5f; targetDistance = objectSize * 1.5f;
targetDistance = Mathf.Clamp(childTargetDistance, minZoomDistance, maxZoomDistance); targetDistance = Mathf.Clamp(childTargetDistance, minZoomDistance, maxZoomDistance);
currentDistance = targetDistance; currentDistance = targetDistance;
targetPositionOffset = Vector3.zero;
Vector3 toCamera = (renderCamera.transform.position - modelCenter).normalized; Vector3 toCamera = (renderCamera.transform.position - modelCenter).normalized;
targetRotation.x = Mathf.Atan2(toCamera.x, toCamera.z) * Mathf.Rad2Deg; targetRotation.x = Mathf.Atan2(toCamera.x, toCamera.z) * Mathf.Rad2Deg;
targetRotation.y = Mathf.Asin(toCamera.y) * Mathf.Rad2Deg; targetRotation.y = Mathf.Asin(toCamera.y) * Mathf.Rad2Deg;*/
ResetView();
} }
private void HandleInput() private void HandleInput()
@ -301,8 +301,9 @@ public class RawImageModelViewer : MonoBehaviour
/// </summary> /// </summary>
public void ResetView() public void ResetView()
{ {
targetRotation = modelInitialRotation; //targetRotation = modelInitialRotation;
targetDistance = defaultZoomDistance; targetRotation = new Vector3(20,130,0);
targetDistance = 1.0f;
targetPositionOffset = Vector3.zero; targetPositionOffset = Vector3.zero;
} }