第1个回答 2020-11-18
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class zhurenwu : MonoBehaviour
{
float sudu = 0.01f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
Vector3 position = transform.position;
position.x = position.x + sudu * horizontal;
position.z = position.z + sudu * vertical;
if (Input.GetButtonDown("Jump")
{
position.y = position.y + 0.3f;
}
transform.position = position;
}
}