Input.GetAxis获取轴-创新互联
static function GetAxis (axisName : string) : float
网页名称:Input.GetAxis获取轴-创新互联
本文链接:http://myzitong.com/article/dcesej.html
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获取轴-创新互联
本文链接:http://myzitong.com/article/dcesej.html