본문 바로가기
게임개발/게임 클라이언트 프로그래밍

벡터 연산의 이해

by pudding81 2024. 1. 25.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class App : MonoBehaviour
{
    [SerializeField]  private Transform a; //멤버변수

    [SerializeField]  private Transform b;
    
    private void Start()
    {        
    
        //두 벡터의 뺄셈 연산 
        //연산 결과 : 방향 벡터 (새로운)
        Vector3 c = b.position - a.position; //벡터의 방향과 길이
      
        DrawArrow.ForDebug(a.position, c, 10, Color.red); 
    }
}

 

'게임개발 > 게임 클라이언트 프로그래밍' 카테고리의 다른 글

표창 던지기  (1) 2024.01.28
SwipeCar  (0) 2024.01.28
룰렛 만들기 GetMouseButtonDown  (1) 2024.01.28
Time.deltaTime  (0) 2024.01.28
벡터의 연산 : 게임오브젝트 이동  (1) 2024.01.28