unity3d学习j记录之 API阅读-001Input.GetAxis
来源:互联网 发布:电脑屏幕色温调节软件 编辑:程序博客网 时间:2024/05/14 15:44
Input.GetAxis
public static float GetAxis(string axisName); 静态函数 返回值是个浮点数
Description 描述
Returns the value of the virtual axis identified by axisName
.
返回由axisName标识的虚拟轴的值。
The value will be in the range -1...1 for keyboard and joystick input. If the axis is setup to be delta mouse movement, the mouse delta is multiplied by the axis sensitivity and the range is not -1...1.
对于键盘和操纵杆输入,该值的范围为-1 ... 1。如果轴设置为增量鼠标移动,则鼠标增量乘以轴灵敏度,范围不为-1 ... 1。
This is frame-rate independent; you do not need to be concerned about varying frame-rates when using this value.
这是帧率独立的;使用此值时,您不必担心变化的帧率。
using UnityEngine;using System.Collections;public class ExampleClass : MonoBehaviour { public float speed = 10.0F; public float rotationSpeed = 100.0F; void Update() { float translation = Input.GetAxis("Vertical") * speed; float rotation = Input.GetAxis("Horizontal") * rotationSpeed; translation *= Time.deltaTime; rotation *= Time.deltaTime; transform.Translate(0, 0, translation); transform.Rotate(0, rotation, 0); }}
public class ExampleClass : MonoBehaviour { public float horizontalSpeed = 2.0F; public float verticalSpeed = 2.0F; void Update() { float h = horizontalSpeed * Input.GetAxis("Mouse X"); float v = verticalSpeed * Input.GetAxis("Mouse Y"); transform.Rotate(v, h, 0); }}
阅读全文
0 0
- unity3d学习j记录之 API阅读-001Input.GetAxis
- unity3d学习j记录之 API阅读-002Time.deltaTime
- Unity3D之float Input.GetAxis(string axisname)
- Input.GetAxis _ Unity3d
- 我的和unity3d的小故事1——恶魔射手之鼠标控制移动之input.getaxis("Horizontal")与input.getaxis("Vertical")
- Input.GetAxis
- Input.GetAxis();
- Input.GetAxis
- Input.GetAxis
- unity Input.GetAxis()函数
- Input.GetAxis()
- Input.GetAxisRaw 与Input.GetAxis
- Input.GetAxisRaw 与Input.GetAxis
- Unity3D学习笔记-android之Input
- Unity3d热门基础之常用API之Input使用详解
- unity Input.GetAxis和Input.GetAxisRaw
- Unity 3D input.GetAxis用法
- Unity3D学习记录——API Invoke函数
- iOS应用的沙盒目录结构
- 多线程启用Task,在循环中初始化Task实例执行错误
- 内核级虚拟化技术
- JavaScript的知识点(二)
- python 类的总结
- unity3d学习j记录之 API阅读-001Input.GetAxis
- strcmp()函数
- spring学习笔记十 通过factoryBean配置bean
- ReactNative坑之记录——drawable包中图片有问题
- svg实现we动画
- 用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型
- Linux下从原文件到可执行文件的过程
- MSYS2 换中科大的源
- 打印页面