Input.GetAxis 获取轴
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 获取轴的更多相关文章
- Unity3D input.GetAxis
input.GetAxis用法:(GetAxis("Mouse X"),GetAxis("Mouse Y"),GetAxis("Mouse Scrol ...
- input file获取选择图片的本地路径和base64路径
input file获取选择图片的本地路径和base64路径 本地路径: myHeadFile: function (e) { // 这里是input file 的onchange事件 ] const ...
- unity Input.GetAxis和Input.GetAxisRaw
float h = Input.GetAxis("Horizontal") ;//h range from -1 to 1 float v = Input.GetAxis(&quo ...
- JS实现冒泡排序,插入排序和快速排序(从input中获取内容)
以前参加面试的时候,被问到过让用JS实现一个快速排序,当时太年轻,并没有回答上来. 于是,这里便把三种排序都用JS来做了一下.结合html,从input文本框中获取输入进行排序. 关于这几种算法的原理 ...
- radio,checkbox,select,input text获取值,设置哪个默认选中
11 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title& ...
- html,图片上传预览,input file获取文件等相关操作
input file常用方法: var obj=document.getElementById("upimage"); var file=obj.files[0];//获取文件数据 ...
- angularjs <input>标签获取时间显示问题
一般的后台管理中,几乎每个管理后台都有设置新密码的功能,但是获取的时候为了好看,都有统一用一定的标签,比如input标签,ng-model来控制显示数据,但是在获取时间的时候用会显示错乱 代码为: & ...
- id就是方法名,如何调用;批量input怎么获取他们的key值作为参数
1.很多Dom的时候,一个个写会比较麻烦,我用ID记载他的方法名: 2.很多input,在数据交互的时候一个个获取会比较繁琐,给一个方法,批量获取. <div id="searchSt ...
- asp.net input怎么获取值
前台: <input type="hidden" name="content" value="content"> 后台: Req ...
随机推荐
- mysql索引记
如果字段是数值型,where 是字符串型,走索引但是,如果字段是字符串型,但是where 是数值型,不走索引
- js date扩展方法
/* File Created: 四月 28, 2015 */ //日期加上天数得到新的日期 //dateTemp 需要参加计算的日期,days要添加的天数,返回新的日期,日期格式:YYYY-MM-D ...
- (二十二)函数fseek() 用法
fseek 函数名: fseek功 能: 重定位流上的文件指针用 法: int fseek(FILE *stream, long offset, int fromwhere);描 述: 函数设置文件指 ...
- Linux的日志错误级别
讯息等级 系统将讯息分为七个主要的等级,依序是由不重要排列到重要讯息等级: info:仅是一些基本的讯息说明而已: notice:比 info 还需要被注意到的一些信息内容: warning 或 wa ...
- 在C#中调用格式工厂进行任意视频格式到FLV的转换
1.下载安装格式工厂和完美解码器 2.运行格式工厂,转换一个RMVB到FLV,注意找个大点的,使时间长一些.防止在未执行步骤3时就结束了 3.在进程中查看某个进程的命令行参数是什么? wmic pro ...
- 原来是adblock惹的祸
一个在本地开发好的网站,放到服务器就不行了.花了好几个小时的时间,最后试着把adblock关了,然后正常了.
- 转 linux任务调度之crontab命令
crontab命令常见于Unix和Linux的操作系统之中,用于设置周期性被执行的指令.该命令从标准输入设备读取指令,并将其存放于"crontab"文件中,以供之后读取和执行. 在 ...
- Python的程序结构[8] -> 装饰器/Decorator -> 装饰器浅析
装饰器 / Decorator 目录 关于闭包 装饰器的本质 语法糖 装饰器传入参数 1 关于闭包 / About Closure 装饰器其本质是一个闭包函数,为此首先理解闭包的含义. 闭包(Clos ...
- JSK 18: 跳跃游戏
题目描述 给定一个非负整数数组,假定你的初始位置为数组第一个下标. 数组中的每个元素代表你在那个位置能够跳跃的最大长度. 请确认你是否能够跳跃到数组的最后一个下标. 例如:$A = [2,3,1,1, ...
- POJ3261 Milk Patterns(二分+后缀数组)
题目求最长的重复k次可重叠子串. 与POJ1743同理. 二分枚举ans判定是否成立 height分组,如果大于等于ans的组里的个数大于等于k-1,这个ans就可行 #include<cstd ...