static function GetAxis (axisName : string) : float

Description描述

Returns the value of the virtual axis identified by 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 。

// A very simplistic car driving on the x-z plane.
// 一个十分简单的在x-z平面的驾车例子
var speed : float = 10.0;
var rotationSpeed : float = 100.0; function Update () {
// Get the horizontal and vertical axis.
//获取横向和纵向坐标轴
// By default they are mapped to the arrow keys.
//默认情况下他们关联到方向键上
// The value is in the range -1 to 1
//值的范围是在-1到1之间
var translation : float = Input.GetAxis ("Vertical") * speed;
var rotation : float = Input.GetAxis ("Horizontal") * rotationSpeed; // Make it move 10 meters per second instead of 10 meters per frame...
// 使它每帧移动10米变为每秒移动10米...
translation *= Time.deltaTime;
rotation *= Time.deltaTime; // Move translation along the object's z-axis
//沿着z轴平移对象
transform.Translate (0, 0, translation);
// Rotate around our y-axis
//以我们的y轴为中心旋转
transform.Rotate (0, rotation, 0);
}
// Performs a mouse look.
//执行一个鼠标观察
var horizontalSpeed : float = 2.0;
var verticalSpeed : float = 2.0;
function Update () {
// Get the mouse delta. This is not in the range -1...1
//获取鼠标增量,范围不在-1...1
var h : float = horizontalSpeed * Input.GetAxis ("Mouse X");
var v : float = verticalSpeed * Input.GetAxis ("Mouse Y");
transform.Rotate (v, h, 0);
}

Input.GetAxis 获取轴的更多相关文章

  1. Unity3D input.GetAxis

    input.GetAxis用法:(GetAxis("Mouse X"),GetAxis("Mouse Y"),GetAxis("Mouse Scrol ...

  2. input file获取选择图片的本地路径和base64路径

    input file获取选择图片的本地路径和base64路径 本地路径: myHeadFile: function (e) { // 这里是input file 的onchange事件 ] const ...

  3. unity Input.GetAxis和Input.GetAxisRaw

    float h = Input.GetAxis("Horizontal") ;//h range from -1 to 1 float v = Input.GetAxis(&quo ...

  4. JS实现冒泡排序,插入排序和快速排序(从input中获取内容)

    以前参加面试的时候,被问到过让用JS实现一个快速排序,当时太年轻,并没有回答上来. 于是,这里便把三种排序都用JS来做了一下.结合html,从input文本框中获取输入进行排序. 关于这几种算法的原理 ...

  5. radio,checkbox,select,input text获取值,设置哪个默认选中

    11 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title& ...

  6. html,图片上传预览,input file获取文件等相关操作

    input file常用方法: var obj=document.getElementById("upimage"); var file=obj.files[0];//获取文件数据 ...

  7. angularjs <input>标签获取时间显示问题

    一般的后台管理中,几乎每个管理后台都有设置新密码的功能,但是获取的时候为了好看,都有统一用一定的标签,比如input标签,ng-model来控制显示数据,但是在获取时间的时候用会显示错乱 代码为: & ...

  8. id就是方法名,如何调用;批量input怎么获取他们的key值作为参数

    1.很多Dom的时候,一个个写会比较麻烦,我用ID记载他的方法名: 2.很多input,在数据交互的时候一个个获取会比较繁琐,给一个方法,批量获取. <div id="searchSt ...

  9. asp.net input怎么获取值

    前台: <input type="hidden" name="content" value="content"> 后台: Req ...

随机推荐

  1. Promotion Counting(USACO)

    题目翻译: zxyer来到了一个神奇的公司工作,之所以神奇,是因为这个公司的员工的职位并不与他们的水平相称,有的职位极低的职员的经验非常丰富,而有些经理甚至老板都是个萌新.有一天,zxyer收到了老板 ...

  2. selenium运行js下载文书网的文件

    from selenium import webdriver driver=webdriver.Chrome() driver.get("http://wenshu.court.gov.cn ...

  3. 【排序算法】java实现

    1.冒泡排序 最简单的排序实现,冒泡排序,是一种交换排序,它的基本思想是:两两比较相邻记录的关键字,如果反序则交换,直到没有反序的记录为止. //冒泡排序 private int[] bubbleSo ...

  4. (6)java基础知识-基本数据类型、数据类型转换

    一.基本数据类型 基本的数据类型一共有四类八种 1.整型 byte:  1字节 取值范围 -128~127 short: 2字节    取值范围 -32768~32767 int:     4字节 取 ...

  5. 陕西师范大学第七届程序设计竞赛网络同步赛 C iko和她的糖【贪心/ STL-优先队列/ 从1-N每个点有能量补充,每段有消耗,选三个点剩下最多能量】

    链接:https://www.nowcoder.com/acm/contest/121/C来源:牛客网 题目描述 iko超级超级喜欢吃糖,有一天iko想出去玩,她计划从1点走到N点(按1,2,3,.. ...

  6. Codeforces Round #447 (Div. 2) A. QAQ【三重暴力枚举】

    A. QAQ time limit per test 1 second memory limit per test 256 megabytes input standard input output ...

  7. Python Unittest与数据驱动

    python中有一个装饰器类DDT,通过它我们可以复用代码,达到数据驱动测试的目的,该类的官方介绍可以参考 http://ddt.readthedocs.io/en/latest/index.html ...

  8. Python的程序结构[1] -> 方法/Method[1] -> 静态方法、类方法和属性方法

    静态方法.类方法和属性方法 在 Python 中有三种常用的方法装饰器,可以使普通的类实例方法变成带有特殊功能的方法,分别是静态方法.类方法和属性方法. 静态方法 / Static Method 在 ...

  9. Java笔记:JDK安装小问题

    昨天在实验室的Windows机器上安JDK,环境变量什么的都配好了,Java -version也没有问题,但是一运行Javac编译就会出现java/lang/NoClassDefFoundError: ...

  10. Linux是32位还是64位

    命令行输入 file /bin/ls 显示 /sbin/init: ELF 64-bit LSB executable, x86-64 ...   则为64位 file /sbin/init /sbi ...