private void LateUpdate() { if (allowOrbitWhileZooming != AllowOrbitWhileZooming) { allowOrbitWhileZooming = AllowOrbitWhileZooming; if (allowOrbitWhileZooming) { ScaleGesture.AllowSimultaneousExecution(PanGesture); } else { ScaleGesture.DisallowSimultaneousExecution(PanGesture); } } Vector3 startPos = Orbiter.transform.position; UpdateOrbit(panVelocity.x, panVelocity.y); UpdateZoom(); ClampDistance(startPos); panVelocity *= OrbitInertia; zoomSpeed *= OrbitInertia; if (ClampBounds != null && !ClampBounds.bounds.Contains(Orbiter.transform.position)) { Vector3 dir = (OrbitTarget.transform.position - Orbiter.transform.position).normalized; float dist; ClampBounds.bounds.IntersectRay(new Ray(Orbiter.transform.position, dir), out dist); Orbiter.transform.position += (dir * dist); } }
private void LateUpdate() { if (allowOrbitWhileZooming != AllowOrbitWhileZooming) { allowOrbitWhileZooming = AllowOrbitWhileZooming; if (allowOrbitWhileZooming) { ScaleGesture.AllowSimultaneousExecution(PanGesture); } else { ScaleGesture.DisallowSimultaneousExecution(PanGesture); } } Vector3 startPos = Orbiter.transform.position; UpdateOrbit(panVelocity.x, panVelocity.y); UpdateZoom(); ClampDistance(startPos); panVelocity *= OrbitInertia; zoomSpeed *= OrbitInertia; }