유니티 3

Debug.DrawRay(), RaycastHit2D hit 으로 바닥체크

예시void FixedUpdate(){ Debug.DrawRay(transform.position, new Vector3(0, -1, 0) * 0.5f, new Color(1, 0, 0), LayerMask.GetMask("Ground")); RaycastHit2D hit = Physics2D.Raycast(transform.position, new Vector3(0, -1, 0), 0.5f, LayerMask.GetMask("Ground")); if (hit.collider != null) { Debug.Log(hit.collider.name); }}1.Debug.DrawRay(시작점,선의길이와 방향,색깔, 감지하고싶은 Mask)-선을 그어주는 함수로 일반적으로 ..

유니티 2D 움직임, AddForce와 velocity 중 어떤게 적당한가

※물리연산이기에fixed update에서 작동  1.().AddForce사용using System.Collections;using System.Collections.Generic;using UnityEngine;public class Player : MonoBehaviour{ //move ,jump ,stop idle public float jumpPower = 10; public float speed = 10; Rigidbody2D cRb;//component RigidBody(최상위 Rigidbody가진 오브젝트 이름:.component) void Awake() { cRb = GetComponentInParent(); } void FixedUp..

유니티 참고 블로그 글 공유-코더제로

(블로그를 그대로 캡쳐해 놓은것입니다, 블로그 링크로 들어가 링크를 확인하세요) https://coderzero.tistory.com/entry/%EC%9C%A0%EB%8B%88%ED%8B%B0-%EB%A7%A4%EB%89%B4%EC%96%BC-%EC%9C%A0%EB%8B%88%ED%8B%B0-%EC%B6%94%EC%B2%9C-%EC%82%AC%EC%9D%B4%ED%8A%B8 [유니티 매뉴얼] 유니티 추천 사이트 1. 유니티 사이트 내용 유니티 코리아 유니티 코리아 홈페이지 유니티 사용자 매뉴얼 유니티 매뉴얼 유니티 스크립팅 API 유니티 스크립팅 API 유니티 퍼스널 버전 설치 유니티 퍼스널 버전 설치 coderzero.tistory.com