打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
GetAxis

AxisExample

using UnityEngine;using System.Collections;public class AxisExample : MonoBehaviour{ public float range; public GUIText textOutput; void Update () { float h = Input.GetAxis("Horizontal"); float xPos = h * range; transform.position = new Vector3(xPos, 2f, 0); textOutput.text = "Value Returned: "+h.ToString("F2"); }}

AxisRawExample

using UnityEngine;using System.Collections;public class AxisRawExample : MonoBehaviour{ public float range; public GUIText textOutput; void Update () { float h = Input.GetAxisRaw("Horizontal"); float xPos = h * range; transform.position = new Vector3(xPos, 2f, 0); textOutput.text = "Value Returned: "+h.ToString("F2"); }}

DualAxisExample

using UnityEngine;using System.Collections;public class DualAxisExample : MonoBehaviour { public float range; public GUIText textOutput; void Update () { float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); float xPos = h * range; float yPos = v * range; transform.position = new Vector3(xPos, yPos, 0); textOutput.text = "Horizontal Value Returned: "+h.ToString("F2")+"\nVertical Value Returned: "+v.ToString("F2"); }}

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
【新提醒】【【AchorU3d学习笔记③】如何实现角色移动及相机平滑跟随】
使用Multiplayer Networking做一个简单的多人游戏例子
博客园 - 喻祥,性情中人 - java浮点运算精度问题的解决
Tutorial 6 : Keyboard and Mouse | opengl
[Unity3D]Unity3D游戏开发之自由视角下的角色控制
[Unity UGUI]各种优化效果
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服