Zoom moves the camera closer or farther from the target the specified amount and also updates the camera's orthographic size to match.
(delta float32)
| 170 | // Zoom moves the camera closer or farther from the target the specified amount |
| 171 | // and also updates the camera's orthographic size to match. |
| 172 | func (oc *OrbitControl) Zoom(delta float32) { |
| 173 | |
| 174 | // Compute direction vector from target to camera |
| 175 | tcam := oc.cam.Position() |
| 176 | tcam.Sub(&oc.target) |
| 177 | |
| 178 | // Calculate new distance from target and apply limits |
| 179 | dist := tcam.Length() * (1 + delta/10) |
| 180 | dist = math32.Max(oc.MinDistance, math32.Min(oc.MaxDistance, dist)) |
| 181 | tcam.SetLength(dist) |
| 182 | |
| 183 | // Update orthographic size and camera position with new distance |
| 184 | oc.cam.UpdateSize(tcam.Length()) |
| 185 | oc.cam.SetPositionVec(oc.target.Clone().Add(&tcam)) |
| 186 | } |
| 187 | |
| 188 | // Pan pans the camera and target the specified amount on the plane perpendicular to the viewing direction. |
| 189 | func (oc *OrbitControl) Pan(deltaX, deltaY float32) { |
no test coverage detected