Unity3D学习记录——刚体跳跃

来源:互联网 发布:ubuntu下安装jdk9 编辑:程序博客网 时间:2022/10/02 15:34
using System.Collections;using System.Collections.Generic;using UnityEngine;public class Jump : MonoBehaviour {    private Rigidbody m_rigidbody;// Use this for initializationvoid Start () {        m_rigidbody = gameObject.GetComponent<Rigidbody>();}// Update is called once per framevoid Update () {        if (Input.GetKey(KeyCode.Space)) {            m_rigidbody.velocity = new Vector3(0, 4.1f, 0);        }}}

原创粉丝点击