Maoyeedy

Jan 18, 2023

一个Unity变焦脚本

Video preview

脚本简介 / Overview

  1. It controls the camera for Third Person Controller.
  1. It uses LeanTween to animate the camera's FOV and distance to player.
  1. It has functions for zooming in, zooming out, and zooming in response to mouse scroll wheel input.
  1. The Update function checks for keyboard and mouse input to determine when to start or stop zooming. The ZoomIn, ZoomOut, and ZoomToDefault functions use LeanTween to smoothly transition the camera's field of view and default distance between the current values and the target values over a specified duration.
  1. 以上 4 条是 ChatGPT 帮我写的。

使用方法 / Usage

  1. Attach the script to the “vThirdPersonCamera” gameobject, and tune its parameters.
  1. For reference, here are the default values I set:
💡
Field of View - 80 Default Distance - 2.2 Right Offset - 0.4

代码本体 / Script

Copyright © 2024 Maoyeedy

logo