unity中 鼠标按下移动端与pc端的位置

if (Input.GetMouseButtonDown(0))

{

Vector2 V = Input.touchCount > 0 ? Input.GetTouch(0).position : new Vector2(Input.mousePosition.x, Input.mousePosition.y);

}

射线检测

if (Input.GetMouseButtonDown(0))

{

ray = Input.touchCount > 0 ? Camera.main.ScreenPointToRay(Input.GetTouch(0).position) : Camera.main.ScreenPointToRay(Input.mousePosition);

}

相关推荐
ue星空6 小时前
【Godot】更换编辑器外观主题
编辑器·游戏引擎·godot
fanfan_hongyun7 小时前
unity 与cad 坐标系映射
unity·游戏引擎
神码编程9 小时前
【Unity】 HTFramework框架(七十)MultiChoiceDropdown可多选的下拉菜单
unity·游戏引擎·ugui·dropdown·下拉菜单
ue星空11 小时前
Godot 2D像素游戏移动抖动、模糊问题解决方案
游戏·游戏引擎·godot
淡海水11 小时前
15-07-YooAsset面试篇-Unity性能优化与内存管理
java·unity·面试·性能优化·c#·游戏引擎
ue星空11 小时前
【Godot】AudioStreamPlayer2D音频播放
游戏引擎·音视频·godot
zhchyun20081 天前
# 【Unity UI 进阶】仿 Element UI 打造企业级 Unity UI 组件库(03)
unity
淡海水2 天前
15-02-YooAsset面试篇-Unity架构设计与源码
java·unity·面试·c#·游戏引擎·yooasset
郝学胜-神的一滴2 天前
中级OpenGL教程 030:gl_FragCoord解锁区域渲染与深度可视化新姿势
c++·unity·游戏引擎·图形渲染·unreal engine·opengl