当前位置:网站首页>Zoom with unity mouse wheel: zoom the camera closer or farther
Zoom with unity mouse wheel: zoom the camera closer or farther
2022-07-06 20:13:00 【LiPing122335】
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class shuBiao : MonoBehaviour {
void Update()
{
// Effect of mouse wheel
if (Input.GetAxis("Mouse ScrollWheel") < 0)
{
if (Camera.main.fieldOfView <= 100)
Camera.main.fieldOfView += 2;
if (Camera.main.orthographicSize <= 20)
Camera.main.orthographicSize += 0.5F;
}
//Zoom in
if (Input.GetAxis("Mouse ScrollWheel") > 0)
{
if (Camera.main.fieldOfView > 2)
Camera.main.fieldOfView -= 2;
if (Camera.main.orthographicSize >= 1)
Camera.main.orthographicSize -= 0.5F;
}
}
}
边栏推荐
- Recursive implementation of department tree
- PHP and excel phpexcel
- golang的超时处理使用技巧
- 转让malloc()该功能后,发生了什么事内核?附malloc()和free()实现源
- Groovy basic syntax collation
- RT-Thread 组件 FinSH 使用时遇到的问题
- Speech recognition (ASR) paper selection: talcs: an open source Mandarin English code switching corps and a speech
- 腾讯云数据库公有云市场稳居TOP 2!
- 语音识别(ASR)论文优选:全球最大的中英混合开源数据TALCS: An Open-Source Mandarin-English Code-Switching Corpus and a Speech
- 5. 無線體內納米網:十大“可行嗎?”問題
猜你喜欢
01 基础入门-概念名词
Selenium advanced operations
【云原生与5G】微服务加持5G核心网
Standardized QCI characteristics
Microservice architecture debate between radical technologists vs Project conservatives
棋盘左上角到右下角方案数(2)
PowerPivot - DAX (first time)
Ideas and methods of system and application monitoring
RT thread I2C tutorial
Example of applying fonts to flutter
随机推荐
Discussion on beegfs high availability mode
Node.js: express + MySQL实现注册登录,身份认证
Notes on beagleboneblack
Initial experience of addresssanitizer Technology
[Yann Lecun likes the red stone neural network made by minecraft]
HDU 1026 search pruning problem within the labyrinth of Ignatius and the prince I
Wechat applet common collection
POJ1149 PIGS 【最大流量】
Example of shutter text component
Deep learning classification network -- zfnet
Synchronization of data create trigger synchronization table for each site
5. Wireless in vivo nano network: top ten "feasible?" problem
AsyncHandler
棋盘左上角到右下角方案数(2)
永磁同步电机转子位置估算专题 —— 基波模型与转子位置角
After solving 2961 user feedback, I made such a change
[play with Linux] [docker] MySQL installation and configuration
It's enough to read this article to analyze the principle in depth
爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解
Special topic of rotor position estimation of permanent magnet synchronous motor -- Summary of position estimation of fundamental wave model