博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
InputModule
阅读量:3921 次
发布时间:2019-05-23

本文共 1158 字,大约阅读时间需要 3 分钟。

using System.Collections;using UnityEngine;class InputModule : MonoBehaviour{    Vector3 vec3;    Vector2 vec2;    void Start()    {        //鼠标位置        vec3 = Input.mousePosition;        //鼠标滚轮        vec2 = Input.mouseScrollDelta;        Input.GetAxis("Mouse  ScrollWheel");        //鼠标点击状态(持续)        Input.GetMouseButton(2);        //鼠标点击按下(瞬间)        Input.GetMouseButtonDown(1);        //鼠标点击抬起(瞬间)        Input.GetMouseButtonUp(0);        //鼠标滑动        Input.GetAxis("Mouse X");        Input.GetAxis("Mouse Y");        //触摸输入        Input.multiTouchEnabled = true;        Input.simulateMouseWithTouches = true;        int touch = Input.touchCount;        Touch[] tou = Input.touches;        bool suppor = Input.touchSupported;        Input.GetTouch(1);        //键盘输入        //返回float区间[-1,1]        Input.GetAxis("Horizontal");        Input.GetAxis("Vertical");        //返回端点值(-1,0,1);        Input.GetAxisRaw("Horizontal");        Input.GetAxisRaw("Vertical");        //按下状态(持续)        //Input.GetKey(KeyCode / string);        //按下状态(瞬间)        //Input.GetKeyDown(KeyCode / string);        //抬起状态(瞬间)        //Input.GetKeyUp(KeyCode / string);    }}

转载地址:http://tgmrn.baihongyu.com/

你可能感兴趣的文章
Leetcode 88. 合并两个有序数组
查看>>
Leetcode 89. 格雷编码
查看>>
Leetcode 67. 二进制求和
查看>>
Leetcode 69. x 的平方根
查看>>
进程、线程与协程
查看>>
Mysql中数据库引擎 INNODB
查看>>
模式1. 简单工厂模式-Java
查看>>
Leetcode 97. 交错字符串
查看>>
Leetcode 26. 删除有序数组中的重复项
查看>>
Leetcode 80. 删除有序数组中的重复项 II
查看>>
python字典赋初值
查看>>
error while loading shared libraries: lib.so.5000“ 错误的原因和解决办法
查看>>
shell 替换文件中的某个字符串
查看>>
ubuntu安装apache2
查看>>
网站实现高并发的方案
查看>>
消息队列知识储备
查看>>
初识docker
查看>>
Leetcode 621. 任务调度器
查看>>
Leetcode 312. 戳气球
查看>>
Leetcode 207. 课程表
查看>>