技术栈

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

Ctrl-c2024-03-27 13:41

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

}

上一篇:HTTPS 从懵懵懂懂到认知清晰、从深度理解到落地实操
下一篇:01背包和完全背包
相关推荐
沉默金鱼
1 天前
Unity实用技能-UI进度条
ui·unity·游戏引擎
老朱佩琪!
2 天前
Unity离线开发经验分享
unity·游戏引擎
Sator1
2 天前
unity的GPUInstance和GPU动画
unity·游戏引擎
沉默金鱼
2 天前
Unity实用技能-模型
unity·游戏引擎
阿里云云原生
3 天前
AgentRun:如何利用 AI Agent 构建现代化的舆情分析解决方案?
人工智能·unity·游戏引擎
在路上看风景
3 天前
2.8 预渲染
unity
老朱佩琪!
3 天前
Unity代理模式
unity·游戏引擎·代理模式
技术小甜甜
3 天前
【Godot】【入门】GDScript 快速上手(只讲游戏里最常用的 20% 语法)
android·游戏·编辑器·游戏引擎·godot
老朱佩琪!
3 天前
Unity命令模式
unity·游戏引擎·命令模式
世洋Blog
3 天前
Unity编辑器基础
unity·c#·编辑器·游戏引擎
热门推荐
01GitHub 镜像站点02从快手“12·22”直播攻击事件看:一次教科书式的业务层饱和攻击03Linux下V2Ray安装配置指南04电脑检测软件—图吧工具箱05Claude Code Skills 实用使用手册06jdk21下载、安装(Windows、Linux、macOS)07UV安装并设置国内源08BongoCat - 跨平台键盘猫动画工具09Web安全中SQL注入绕过WAF的具体手法和实战案例10SQLmap 完整使用指南:环境搭建 + 命令详解 + 实操案例