日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Input.GetAxis 获取轴

發布時間:2025/3/20 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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...1var h : float = horizontalSpeed * Input.GetAxis ("Mouse X");var v : float = verticalSpeed * Input.GetAxis ("Mouse Y");transform.Rotate (v, h, 0); }

?

轉載于:https://www.cnblogs.com/vincentDr/p/3678354.html

總結

以上是生活随笔為你收集整理的Input.GetAxis 获取轴的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。