基本方法概览
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class rigidbodyTest : MonoBehaviour {
private Rigidbody _rigidbody;
// Use this for initialization
void Start ()
{
_rigidbody = transform.GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown(KeyCode.Q))
{
_rigidbody.velocity = new Vector3(1,1,1); //给其一个速度矢量
// _rigidbody.position = new Vector3(5,5,5); //给其一个位置
}
if (Input.GetKeyDown(KeyCode.W))
{
_rigidbody.Sleep();//强制性使刚体休眠,不动了;休眠是性能优化的一个措

最低0.47元/天 解锁文章
342

被折叠的 条评论
为什么被折叠?



