当前位置:网站首页>Unity mobile end sliding screen rotation
Unity mobile end sliding screen rotation
2022-06-30 05:11:00 【Shannan HSY】
float currentRotY = 0f;
public GameObject roleObj = null;
private void __RoleRotation(float detalTime) {if( Input.touchCount == 1 ) {
if( Input.GetTouch(0).phase == TouchPhase.Began ) {
firstPosX = Input.GetTouch(0).position.x;
currentRotY = roleObj.transform.localRotation.eulerAngles.y;
}
if( Input.GetTouch(0).phase == TouchPhase.Moved ) {
float currentPosX = Input.GetTouch(0).position.x;
float XAxis = firstPosX - currentPosX;
if( Mathf.Abs(XAxis) < 5 ) {
return;
}
roleObj.transform.localRotation = Quaternion.Euler(new Vector3(0f, currentRotY + XAxis , 0));
}
if( Input.GetTouch(0).phase == TouchPhase.Ended ) {
firstPosX = 0f;
currentRotY = roleObj.transform.localRotation.eulerAngles.y;
}
}
}
边栏推荐
- Some problems encountered in unity steamvr
- Operation file file class method
- [recruitment] UE4 Development Engineer
- Detailed explanation of the process of "flyingbird" small game (camera adjustment and following part)
- pycharm 数据库工具
- z-index属性在什么情况下会失效?
- Nestjs中控制器和路由的配置使用
- Modbus protocol register
- JPA复合主键使用
- 力扣27. 移除元素
猜你喜欢

Pit of smoothstep node in shadergraph

Create transfer generation point

How does unity use mapbox to implement real maps in games?
![[notes] unity Scrollview button page turning](/img/c7/47c4056871d0212ac61524539f0d0e.jpg)
[notes] unity Scrollview button page turning
Sourcetree usage

Unity Logitech steering wheel access

Unity ugui text value suspended enlarged display add text background

Solution to Autowired annotation warning

PWN入门(2)栈溢出基础

MinGW-w64下载文件失败the file has been downloaded incorrectly!
随机推荐
2021-06-17 solve the problem of QML borderless window stretching, window jitter and flicker when stretching and shrinking
mmdet之Loss模块详解
Unrealeengine4 - about uobject's giant pit that is automatically GC garbage collected
One command to run rancher
Chapter 9 of OpenGL super classic (version 7): fragment processing and frame buffering
Force buckle 977 Square of ordered array
Some problems encountered in unity steamvr
Unity lens making
Unity project hosting platform plasticscm (learn to use 2)
Log writing specification
The difference between SVG and canvas
Unity 3D model operation and UI conflict Scrollview
Configuration and use of controllers and routes in nestjs
How can the international trading platform for frying US crude oil guarantee capital security?
Unity Logitech steering wheel access
Initial environment configuration of the list of OpenGL super classic (version 7) vs2019
Solution to Autowired annotation warning
MinGW-w64下载文件失败the file has been downloaded incorrectly!
Operation of JSON file
Unity download and installation website