level 5
wind2号
楼主
Rigidbody rbody;
float speed = 5;
float rotationSpeed = 5;
// Start is called before the first frame update
void Start()
{
rbody = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
//Move();
}
private void FixedUpdate()
{
Move();
}
private void Move()
{
float vertical = Input.GetAxis("Vertical");//垂直输入
rbody.velocity = rbody.transform.forward * vertical * speed*Time.deltaTime;//速度
float horizontal = Input.GetAxis("Horizontal");//水平输入
rbody.angularVelocity = rbody.transform.up * horizontal * rotationSpeed*Time.deltaTime;//旋转速度
}
2021年09月28日 18点09分
1
float speed = 5;
float rotationSpeed = 5;
// Start is called before the first frame update
void Start()
{
rbody = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
//Move();
}
private void FixedUpdate()
{
Move();
}
private void Move()
{
float vertical = Input.GetAxis("Vertical");//垂直输入
rbody.velocity = rbody.transform.forward * vertical * speed*Time.deltaTime;//速度
float horizontal = Input.GetAxis("Horizontal");//水平输入
rbody.angularVelocity = rbody.transform.up * horizontal * rotationSpeed*Time.deltaTime;//旋转速度
}