当前位置:网站首页>La caméra Unity tourne avec la souris
La caméra Unity tourne avec la souris
2022-04-23 04:41:00 【Long chubby Blog】
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraMove : MonoBehaviour {
float _rotationX;
float rotationY;
public float sensitivityHor = 5.0f;
public float sensitivityVert = 5.0f;
public float minimumVert = -45.0f;
public float maximumVert = 45.0f;
// Update is called once per frame
void Update()
{
//Mouvement de la caméra
//float x = Input.GetAxis("Horizontal") * Time.deltaTime * 5;
//float y = Input.GetAxis("Vertical") * Time.deltaTime * 5;
//transform.Translate(x, 0, y);
// Limiter la portée du Mouvement de la caméra
//float move_x = Mathf.Clamp(transform.position.x, -20f, 20f);
//float move_y = Mathf.Clamp(transform.position.y, -20f, 20f);
//float move_z = Mathf.Clamp(transform.position.z, -20f, 20f);
//transform.position = new Vector3(move_x, move_y, move_z);
// Clic droit pour faire tourner la caméra
if (Input.GetMouseButton(1))
{
rotationY = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityHor;
_rotationX -= Input.GetAxis("Mouse Y") * sensitivityVert;
_rotationX = Mathf.Clamp(_rotationX, minimumVert, maximumVert);
transform.localEulerAngles = new Vector3(_rotationX, rotationY, 0);
}
}
}
版权声明
本文为[Long chubby Blog]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230441112442.html
边栏推荐
- Bacterial infection and antibiotic use
- FAQ of foreign lead and alliance Manager
- IEEE Transactions on systems, man, and Cybernetics: Notes for systems (TSMC)
- Supplement: Annotation
- leetcode005--原地删除数组中的重复元素
- Recommended scheme of national manufactured electronic components for intelligent electronic scales
- Logger and zap log Library in go language
- Migrate from MySQL database to AWS dynamodb
- Redis 命令大全
- Interaction of diet gut microbiota on cardiovascular disease
猜你喜欢

New terminal play method: script guidance independent of technology stack

Use recyclerview to realize left-right side-by-side classification selection

Brushless motor drive scheme based on Infineon MCU GTM module

How to regulate intestinal flora? Introduction to common natural substances, probiotics and prebiotics

Effects of antibiotics on microbiome and human health

Gut liver axis: host microbiota interaction affects hepatocarcinogenesis

MYSQL去重方法汇总

Recommended scheme for national production of electronic components for wireless charging

Microbial neuroimmune axis -- the hope of prevention and treatment of cardiovascular diseases

Experience summary and sharing of the first prize of 2021 National Mathematical Modeling Competition
随机推荐
Microbial neuroimmune axis -- the hope of prevention and treatment of cardiovascular diseases
那些年我面试过的Android开发岗总结(附面试题+答案解析)
eksctl 部署AWS EKS
Redis 命令大全
229. Find mode II
leetcode007--判断字符串中的括号是否匹配
Logger and zap log Library in go language
Gut liver axis: host microbiota interaction affects hepatocarcinogenesis
Shanghai Hangxin technology sharing 𞓜 overview of safety characteristics of acm32 MCU
【时序】基于 TCN 的用于序列建模的通用卷积和循环网络的经验评估
IEEE Transactions on industrial information (TII)
Ali's ten-year technical experts jointly created the "latest" jetpack compose project combat drill (with demo)
Go反射法则
io. Platform. packageRoot; // ignore: deprecated_ Member_ use
Basic operation of sequence table
第四章 --- 了解标准设备文件、过滤器和管道
在AWS控制台创建VPC(无图版)
leetcode004--罗马数字转整数
thymeleaf th:value 为null时报错问题
Phishing for NFT