1
점프 버튼을 누르기 전에 캐릭터가 점프하려고하지만 캐릭터가 위로 이동합니다. 그것은 또한 돌아 오지 않고 그냥 떠 있습니다.점프 문제 - 점프를하기 전에 떠 다니는 문제
using UnityEngine;
using System.Collections;
public class Movement : MonoBehaviour {
public float speed;
void Update() {
if (Input.GetKeyDown("space")) {
rigidbody.AddForce (Vector3.up * 10);
Debug.Log("Space has been pressed");
}
}
void FixedUpdate() {
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce(movement * speed * Time.deltaTime);
rigidbody.AddForce (Vector3.up * 10);
}
}
}