当前位置:网站首页>Zoom with mouse wheel
Zoom with mouse wheel
2022-06-28 23:58:00 【qq_ fifty-nine million eight hundred and twenty-three thousand 】
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Scroll : MonoBehaviour {
void Update () {
if (Input.GetAxis ("Mouse ScrollWheel")<0)// Move the mouse wheel forward
{
if (Camera .main.fieldOfView <100)// When the camera is a perspective camera , Set a maximum magnification value
{
Camera.main.fieldOfView += 5;// Slide once to move the lens forward 5
}
if (Camera .main.orthographicSize <20)// When the camera is an orthographic camera , Set a maximum magnification value
{
Camera.main.orthographicSize += 0.5f;// Slide once to move the lens forward 0.5
}
}
if (Input .GetAxis ("Mouse ScrollWheel")>0)// Mouse wheel backward stroke
{
if (Camera .main.fieldOfView >5)
{
Camera.main.fieldOfView -= 5;
}
if (Camera .main.orthographicSize>1)
{
Camera.main.orthographicSize -= 0.5f;
}
}
}
}
边栏推荐
- Stm32f407------- general timer
- LinkedIn DataHub --- 经验分享
- Machine learning 4-dimension reduction technology
- 【LeetCode】21. Merge two ordered linked lists - go language solution
- Scrapy uses xlwt to implement the exporter that exports data in Excel format
- Trois questions PWN
- Stm32f407 ------ serial (serial port) communication
- SQL note 2 [MySQL]
- Technology sharing | software development process that you must understand if you want to get started with testing
- Reading notes of English grammar new thinking Basic Edition 2 (I)
猜你喜欢
随机推荐
Easy to use free ppt template
Advice to friends
Yyds dry goods count 【 vs code work record III 】 set vs code format
三个pwn题
请问指南针股票软件可靠吗?在上面交易股票安全吗?
解决ConfigParser解析中文问题
After eight years of testing and opening experience and interview with 28K company, hematemesis sorted out high-frequency interview questions and answers
Is it safe and reliable to open a securities account in Yixue school?
【OpenCV】—线性滤波:方框滤波、均值滤波、高斯滤波
MySQL connection query is easy to understand
TypeScript --第三节:接口
[buuctf.reverse] 131-135
ROS2中的行为树 BehaviorTree
【C Primer Plus第二章课后编程题】
TypeScript -- 第六节 泛型
12.物体检测Mask-Rcnn
TypeScript--第四节:函数
This thing is called a jump watch?
SQL note 2 [MySQL]
Machine learning 6-decision tree









