码迷,mamicode.com
首页 > 编程语言 > 详细

unity 的一些API-01

时间:2017-10-14 01:45:00      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:ons   sla   input   ota   public   oid   官方   解释   float   

public static float GetAxis(string axisName);

看下原话解释:

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.

This is frame-rate independent; you do not need to be concerned about varying frame-rates when using this value.

大意:返回一个虚轴的值给对象,这个值在-1到1之间,而鼠标则不是-1到1.      如官方给出的代码:
 
public float speed = 10.0F;
public float rotationSpeed=100.0F;
void()
{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);
 

unity 的一些API-01

标签:ons   sla   input   ota   public   oid   官方   解释   float   

原文地址:http://www.cnblogs.com/redkop/p/7664153.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!