Plane 오브젝트에 캐릭터 올려둔 모습임.
지금은 땅에 잘 붙어있는 모습임.
시작만 하면 공중으로 붕 뜸
아래는 스크립트임
using UnityEngine; using UnityEngine.Animations; public class PlayerMovement : MonoBehaviour { Vector3 direction; Vector3 velocity; Animator anim; CharacterController cc; public float speed; public Transform cameraTransform; // 카메라 Transform public float jumpHeight = 2f; // 점프 높이 설정 private void Start() { velocity.y = 0f; anim = GetComponent<Animator>(); cc = GetComponent<CharacterController>(); } private void Update() { if (cc.isGrounded) { float horizontal = Input.GetAxis("Horizontal"); float vertical = Input.GetAxis("Vertical"); direction = new Vector3(horizontal, 0f, vertical).normalized; Vector3 cameraForward = cameraTransform.forward; Vector3 cameraRight = cameraTransform.right; cameraForward.y = 0f; cameraRight.y = 0f; Vector3 moveDirection = direction.x * cameraRight + direction.z * cameraForward; velocity = moveDirection * speed; if (velocity != Vector3.zero) { transform.rotation = Quaternion.LookRotation(velocity); anim.SetBool("isWalking", true); } else { anim.SetBool("isWalking", false); } } velocity.y += Physics.gravity.y * Time.deltaTime; cc.Move(velocity * Time.deltaTime); } }Radius,Height 줄이니까 공중에 뜨지는 않는데 이래도 되는건가여?
글고 저 빨간테두리는 뭔가요?
코드 어느 부분을 수정했는지 보여줘야지, 그냥 저 캐릭터 rigid body 크기가 크게 설정돼있던거 같은데
Collider가 크게 설정 되어있던 것 같다는 의미인가요?
밑에 박혀있는 파란색 럭비공 같은거 뭐임?
모르게씀...
모델, 애니메이터 컨트롤러 문제 아닐지 - dc App