当前位置:网站首页>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
边栏推荐
- Programmers complain: I really can't live with a salary of 12000. Netizen: how can I say 3000
- A lifetime of needs, team collaboration can play this way on cloud nailing applet
- 做数据可视化应该避免的8个误区
- 电钻、电锤、电镐的区别
- 简单的拖拽物体到物品栏
- Improving 3D object detection with channel wise transformer
- shell wc (统计字符数量)的基本使用
- The 14th issue of HMS core discovery reviews the long article | enjoy the silky clip and release the creativity of the video
- Flink's important basics
- KVM error: Failed to connect socket to ‘/var/run/libvirt/libvirt-sock‘
猜你喜欢

Coinbase:关于跨链桥的基础知识、事实和统计数据

Practice and exploration of knowledge map visualization technology in meituan

Small volume Schottky diode compatible with nsr20f30nxt5g

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

HMS Core Discovery第14期回顾长文|纵享丝滑剪辑,释放视频创作力

Unity RawImage背景无缝连接移动

那些年我面试过的Android开发岗总结(附面试题+答案解析)

Effects of antibiotics on microbiome and human health

Improving 3D object detection with channel wise transformer

补充番外14:cmake实践项目笔记(未完待续4/22)
随机推荐
MySQL - data read / write separation, multi instance
leetcode008--实现strStr()函数
383. 赎金信
Jetpack 之 LifeCycle 组件使用详解
[timing] empirical evaluation of general convolution and cyclic networks for sequence modeling based on TCN
Error occurs when thymeleaf th: value is null
A heavy sword without a blade is a great skill
io.Platform.packageRoot; // ignore: deprecated_member_use
How to regulate intestinal flora? Introduction to common natural substances, probiotics and prebiotics
Chapter 4 - understanding standard equipment documents, filters and pipelines
重剑无锋,大巧不工
mysql table 中增加列的SQL语句
1个需求的一生,团队协作在云效钉钉小程序上可以这么玩
Brushless motor drive scheme based on Infineon MCU GTM module
Apache Bench(ab 压力测试工具)的安装与使用
Basic operation of sequence table
Iron and intestinal flora
mysql ,binlog 日志查询
leetcode003--判断一个整数是否为回文数
IEEE Transactions on industrial information (TII)