public class Sphere : MonoBehaviour
{
//这个脚本是用来让物体吃金币的
GameObject oneBLQ;
Rigidbody OneRigi;
public float FORCECONTROL;
// Start is called before the first frame update
void Start()
{
oneBLQ = GameObject.Find("Sphere");
OneRigi = oneBLQ.GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
OneRigi.AddForce(new Vector3(0, 0, 1 * FORCECONTROL * Time.deltaTime), ForceMode.Impulse);
OneRigi.AddTorque(new Vector3(0, -1, 0) * FORCECONTROL * Time.deltaTime, ForceMode.Impulse);
}
}
}