본문 바로가기

유니티 개발5

3D 캐릭터 팔, 주먹 동작 구현 이번에는 팔과 팔동작을 추가시켜봤습니다. 상대 객체를 공격하면 아래 콘솔 창에 정보가 출력되도록 설계하였으나 아직 객체는 땅바닥 밖에 없어서 땅을 공격하면 콘솔에 객체 이름이 출력됩니다. 노트북으로 작업해서 영상이 많이 끊깁니다. 추가된 코드 Hand.cs, HandController.cs Hand.cs using System.Collections; using System.Collections.Generic; using UnityEngine; public class Hand : MonoBehaviour { public string handName; // 맨손, 너클 구분 public float range; // 공격범위 public int damage; // 공격력 public float workSpee.. 2021. 8. 17.
지형제작 (나무, 잔디, 돌) 지형을 제작하고 나무, 잔디를 만들어보았으나 노트북이 살려달라고 외치길래 그만둘려고 했으나 잔디 밀도를 낮추면 렉이 걸리지 않습니다. 잔디 수정 후 2021. 8. 17.
3D 캐릭터 움직임 심화 점프, 앉기, 달리기 추가 using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerController : MonoBehaviour { // 스피드 조정 변수 [SerializeField] private float walkSpeed; // 걸음속도 [SerializeField] private float runSpeed; // 달리기속도 [SerializeField] private float crouchSpeed; // 앉기상태에서의 속도 private float applySpeed; // 임시속도 저장변수 [SerializeField] private float jumpForce; // 점.. 2021. 8. 17.
3D 캐릭터 움직임 기초 using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerController : MonoBehaviour { [SerializeField] private float walkSpeed; // 걸음속도 [SerializeField] private float lookSensitivity; // 마우스 민감도 [SerializeField] private float cameraRotationLimit; // 위아래 시선 각도 제한 private float currentCameraRotationX = 0; [SerializeField] private Camera theCamera; private R.. 2021. 8. 16.
2D 상하좌우 이동 using UnityEngine; public class Movement2D : MonoBehaviour { private float moveSpeed = 5.0f; // 속도 private Vector3 moveDirection = Vector3.zero; // 방향 초기화 private void Update() { float x = Input.GetAxisRaw("Horizontal"); // 수평 방향키 float y = Input.GetAxisRaw("Vertical"); // 수직 방향키 moveDirection = new Vector3(x, y, 0); // 방향 설정 transform.position += moveDirection * moveSpeed * Time.deltaTime; // 위.. 2021. 8. 16.