IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]unity3d随笔-4

    u010255642发表于 2017-03-24 09:47:00
    love 0
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class Tank : MonoBehaviour {
    
    	// Use this for initialization
    	void Start () {
    		
    	}
    	
    	// Update is called once per frame
    	void Update () {
            //旋转
            float steer = 20;//旋转速度
            float x = Input.GetAxis("Horizontal");//左右转动方向
            transform.Rotate(0, x * steer * Time.deltaTime, 0);
            //前后
            float speed = 3f;
            float y = Input.GetAxis("Vertical");//前后转动方向
            Vector3 s = y * transform.forward * speed * Time.deltaTime;
            transform.transform.position += s;
    	}
    }
    



沪ICP备19023445号-2号
友情链接