你好,我想找出为什么我的跳跃不一致。我查看了许多问题,但仍然找不到解决方案。如果有人能提供帮助那就太棒了!:D
using UnityEngine;
using System.Collections;
public class BallMovement : MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
Camera mainCamera = GameObject.FindGameObjectWithTag("8BallCamera").GetComponent<Camera>() as Camera;
float moveHorizontal = Input.GetAxisRaw ("Horizontal");
float moveVertical = Input.GetAxisRaw("Vertical");
Vector3 movement = mainCamera.transform.forward * moveVertical * 30;
rb.AddForce (movement * speed);
if (Input.GetKeyDown("space")) {
rb.AddForce(0,2f,0, ForceMode.Impulse);
}
}
}
呼如林
相关分类