获取轴向与键
来源:互联网 发布:扒一扒陈娅安 知乎 编辑:程序博客网 时间:2024/04/21 00:08
获取轴向
float speed = 10.0f;
float speed_w = 100.0f;
void Update()
{
float translion = Input.GetAxis("Vertical") * speed;
//获取鼠标的垂直轴向,返回值是float类型
//局部变量,只能在当前函数里面运用
float ratation = Input.GetAxis("Horizontal") * speed_w;
transform.Translate(0,0,translion);//让物体移动,调用垂直轴向
transfrom.Rotate(0,rotation,0);//让物体旋转,调用水平轴向
if(Input.GetAxis("Mouse ScrollWheel") != 0)//获取鼠标滚轮,非0(静止)状态
{
print("滚轮在动");
}
}
获取键
if(Input.GetKey(KeyCode.W))//按下时实时返回为true
if(Input.GetKeyDown(KeyCode.S))//按下的第一帧返回为true
if(Input.GetKeyUp(KeyCode.S))//抬起的第一帧返回为true
if(Input.GetMouseButtonDown(2))//获取鼠标中键,左键为0,右键为1
0 0
- 获取轴向与键
- 3D空间中射线与轴向包围盒AABB的交叉检测算法
- 3D空间中射线与轴向包围盒AABB的交叉检测算法
- 3D空间中射线与轴向包围盒AABB的交叉检测算法
- AABB轴向包围盒
- AABB轴向包围盒
- pandas 轴向连接
- c#代码实现轴向镂空效果
- 3ds max中锁定轴向进行吸附操作
- Unity3d 和 3dmax轴向问题以及快速解决方案
- 9轴陀螺仪KF系列算法的轴向问题
- BGRABitmap图像操作8:轴向的木质纹理
- python pandas中对Series数据进行轴向连接
- STM32f103 读LIS302DL传感器X、Y、Z轴向寄存器
- PHP获取数组的键与值
- js获取json中的键与值
- 获取日期与时间
- 信息获取与总结
- android:Only the original thread that created a view hierarchy can touch its views
- 如何查看CSDN 排名
- 全国普通高校招生进入互联网时代
- android Installation failed due to invalid URI! 错误处理
- Objective-C对象模型及应用
- 获取轴向与键
- PAT-A1111. 图-Dijkstra输出最短路径
- 欢迎使用CSDN-markdown编辑器
- perl 铜板街登录接口
- PopupWindow在onCreate()中直接show的异常
- 高效大整数运算库-------An Efficient Library for BigInteger
- webpack loader 一览表
- Android应用签名打包相关问题
- React Native ListView中图片加载优化处理(三)