# ModelController.cs

## Fields & Properties

### Transform target

The target 3D model to control.

### GameObject rotationInteractionZone

The UI zone that allows rotation interactions.

### float rotateSpeed

Controls the rotation speed.\
**Default:** `0.1f`

### float dampingFactor

Determines how quickly rotation inertia slows down.\
**Default:** `0.9f`

### float minVelocity

The minimum velocity required to apply rotation inertia.\
**Default:** `0.01f`

### bool canRotate

Enables or disables rotation functionality.\
**Default:** `true`

### bool uiRaycastHack

Tracks whether rotation is disabled due to UI interactions.\
(Exposed as the property `UIRaycastHack`.)

### float minZoomFactor

The minimum scale factor for zoom.\
**Default:** `0.5f`

### float maxZoomFactor

The maximum scale factor for zoom.\
**Default:** `2.0f`

### float zoomZOffset

The Z-axis offset for zoom progression.\
**Default:** `0.5f`

### float zoomLerpSpeed

Interpolation speed for smooth zooming.\
**Default:** `10f`

### float rotationVelocity

Tracks the current rotation velocity of the model.\
(Exposed as the property `RotationVelocity`.)

### Vector3 initialPosition

The initial position of the target.

### Quaternion initialRotation

The initial rotation of the target.

### Vector3 initialScale

The initial scale of the target.

### float currentZoomFactor

The current zoom scale factor.\
**Default:** `1f`

### bool isDragging

Indicates if the model is being dragged.

### bool isPinching

Indicates if a pinch-to-zoom gesture is in progress.

### float initialPinchDistance

Distance between touch points at the start of a pinch gesture.

### float pinchStartZoomFactor

Zoom factor at the start of a pinch gesture.

## Methods

### void Initialize(Vector3 initPos, Quaternion initRot, Vector3 initScale)

Resets the target's transform and internal state to the specified initial values.

* `Vector3 initPos`: Initial position of the target.
* `Quaternion initRot`: Initial rotation of the target.
* `Vector3 initScale`: Initial scale of the target.

### void HandleTouchRotation()

Handles single-touch input for model rotation.

### void HandleMouseRotation()

Handles mouse input for model rotation.

### void DoRotation()

Applies rotation to the target using the current rotation velocity.

### bool IsOverRotationInteractionObject(Vector2 position)

Determines if a given screen position is over the rotation interaction zone.

* `Vector2 position`: The screen position to check.
* **Returns:** `true` if over the interaction zone; otherwise `false`.

### void HandlePinchToZoom()

Handles pinch gestures for zooming in/out of the model.

### void ApplyZoom()

Updates the target's scale and position based on the current zoom factor.
