球的移动方法一:
球的基本移动方法一:
transform.Translate,球只会平移前进
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class move : MonoBehaviour
{
public float suDu;
// Start is called before the first frame update
void Start()
{
suDu = 10.0f;
}
// Update is called once per frame
void Update()
{
if(Input.GetKey(KeyCode.W))
{
transform.Translate(Vector3.forward * suDu * Time.deltaTime);
}
if (Input.GetKey(KeyCode.S))