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);

}

相关推荐
lambda1 小时前
游戏开发者的CMU动作数据使用指南:如何将AMC文件转Unity动画
unity·游戏开发·动作捕捉·cmu
淡海水2 小时前
【节点】[ComputeVertexPosition节点]原理解析与实际应用
unity·游戏引擎·shadergraph·图形·position·compute·vertex
淡海水1 天前
【节点】[ScleraLimbalRing节点]原理解析与实际应用
unity·游戏引擎·shadergraph·图形·ring·limbal·sclera
ellis19701 天前
Unity特殊目录小结
unity
淡海水2 天前
【节点】[IrisOutOfBoundColorClamp节点]原理解析与实际应用
unity·游戏引擎·iris·shadergraph·图形·clamp·bound
风痕天际2 天前
Godot扫雷游戏制作记录1——基础场景搭建
游戏·游戏引擎·godot·gdscript·教程
上证50指数etf2 天前
Unity面试总结
unity
爱搞虚幻的阿恺3 天前
Niagara粒子系统-超炫酷的闪电特效(第二期 旋转的纸片)
游戏·游戏引擎·虚幻
WarPigs3 天前
Unity渲染问题记录
unity·游戏引擎