Unity中Input.GetAxis方法的返回值含义
来源:互联网 发布:h5dm新域名 编辑:程序博客网 时间:2024/05/16 23:45
Unity中Input.GetAxis方法的返回值含义
方法:public static float GetAxis(string axisName)
我对返回值的理解
返回输入设备在方法参数axisName所指定的轴上的位移量,该位移量由此次调用该方法时输入设备在轴上的位置与上次调用该方法时输入设备在轴上的位置相减得出。
官方代码文档的解释
Returns the value of the virtual axis identified by axisName.
返回根据参数名所指定的虚拟轴上的数值。
检验代码
通过下面的代码对我的理解进行检验,在Unity中运行场景后,控制台始终输出equal
,初步证实我的猜想应该是正确的。而后我把Update
方法改为FixedUpdate
,再次运行,控制台仍然始终输出equal
,;再把FixedUpdate
的频率从默认的每秒50
次改成每秒5
次,运行场景仍然输出equal
。
private float lastFrameMousePositonY = 0;void Update(){ // 此帧中鼠标在Y方向上相对上一帧的偏移量 float offset = Input.mousePosition.y - lastFrameMousePositonY; if(Input.GetAxis("Mouse Y") - offset < 0.0001) { print("equal"); } lastFrameMousePositonY = Input.mousePosition.y;}
输出结果:
0 0
- Unity中Input.GetAxis方法的返回值含义
- unity Input.GetAxis()函数
- unity Input.GetAxis和Input.GetAxisRaw
- Unity 3D input.GetAxis用法
- Input.GetAxis
- Input.GetAxis();
- Input.GetAxis
- Input.GetAxis
- Unity 方向键输入 Input.GetAxis() 和Input.GetAxisRaw()
- unity中Input的几个方法
- 【转】Input.GetAxisRaw 与Input.GetAxis的区别
- Unity中Input 方法总结
- Input.GetAxis _ Unity3d
- Input.GetAxis()
- 查询GetLastError返回值含义的方法
- Input.GetAxisRaw 与Input.GetAxis
- Input.GetAxisRaw 与Input.GetAxis
- PHP中var_dump()返回值的含义
- Spring Boot中@Controller和@restController的区别
- jquery + ajax + json入门实例
- 在Spring中复制粘贴项目
- oracle if 和 case语句的使用
- grafana弱口令检测
- Unity中Input.GetAxis方法的返回值含义
- mysql去除重复记录
- 在Linux中让echo命令显示带颜色的字
- JDBC中事务的使用
- 应急资源管理系统方案
- .NET日期类型序列化后返回前台格式转换问题
- 写给java web一年左右工作经验的人
- 一篇故事讲述了计算机网络里的基本概念:网关,DHCP,IP寻址,ARP欺骗,路由,DDOS等
- 2017.5小结