当前位置:网站首页>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;
}
}
}
边栏推荐
- The file has been downloaded incorrectly!
- MinGW-w64下载文件失败the file has been downloaded incorrectly!
- Unity + hololens publishing settings
- Unity packaging failure solution
- Modbus protocol register
- Connect() and disconnect() of socket in C #
- Procedural animation -- inverse kinematics of tentacles
- Unity call Exe program
- Golan no tests were run: fmt Printf() &lt; BUG&gt;
- Singleton mode in unity
猜你喜欢

Force buckle 59 Spiral matrix II

redis集群概念

Unity3d Google Earth

Records of some problems encountered during unity development (continuously updated)

【 VCS + Verdi joint simulation】 ~ Taking Counter as an Example

Intellj idea jars projects containing external lib to other project reference methods - jars

东塔攻防世界—xss绕过安全狗

Unity lens making

Win10 vs2015 compiling curaengine

Force buckle 977 Square of ordered array
随机推荐
QT connecting external libraries
Chapter 11 advanced data management of OpenGL super classic (version 7)
Unity call Exe program
Some books you should not miss when you are new to the workplace
力扣2049:统计最高分的节点数目
Steamvr causes abnormal scene camera
Postman 做测试的 6 个常见问题
很紧张,第一天做软件测试,需要做什么?
Unity3d lookat parameter description
Nestjs入门和环境搭建
Unity Logitech steering wheel access
[notes] unity webgl input Chinese
On mask culling of unity
Under what conditions does the Z-index attribute expire?
虚析构和纯虚析构
Configuration and use of controllers and routes in nestjs
The file has been downloaded incorrectly!
One command to run rancher
[learning notes] AssetBundle, xlua, hot update (use steps)
Unity ugui text value suspended enlarged display add text background