Strata - v1.4.10
    Preparing search index...

    Function smoothDampVector3

    • Unity-style smooth damping for Vector3 positions.

      Provides organic, spring-like camera movement toward a target position. Each axis is independently damped for smooth 3D motion without overshooting.

      Parameters

      • current: Vector3

        Current position

      • target: Vector3

        Target position

      • velocity: Vector3

        Velocity vector (mutated per-axis)

      • smoothTime: number

        Approximate time to reach target (seconds)

      • deltaTime: number

        Time elapsed since last frame (seconds)

      • maxSpeed: number = Infinity

        Optional maximum speed limit per axis

      • Optionalout: Vector3

        Optional output vector (avoids allocation)

      Returns Vector3

      New smoothed position

      const velocity = new THREE.Vector3();
      const smoothPos = smoothDampVector3(
      camera.position,
      targetPosition,
      velocity,
      0.3,
      deltaTime
      );
      camera.position.copy(smoothPos);