๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ‘จ๐Ÿผ‍๐Ÿ’ป๊ฐœ๋ฐœ/์œ ๋‹ˆํ‹ฐ

์œ ๋‹ˆํ‹ฐ - ์นด๋ฉ”๋ผ ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๊ณ ์ •ํ•˜๊ธฐ

by Janger 2021. 11. 28.
728x90
๋ฐ˜์‘ํ˜•

[FollowPlayer.cs]

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


public class FollowPlayer : MonoBehaviour
{

	public GameObject player;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = player.transform.position + new Vector3(0, 1.5f, -8) ;
    }
}

 

Player ๊ฐ’์„ ์ค„ ๋•Œ์—๋Š” ์˜ค๋ฅธ์ชฝ์— ์•„์ฃผ ์ž‘์€ ๋™๊ทธ๋ผ๋ฏธ๊ฐ€ ๋ณด์ด๋Š”๋ฐ ๊ทธ๊ฑฐ ๋ˆ„๋ฅด๋ฉด ์˜ค๋ธŒ์ ํŠธ ๋ฆฌ์ŠคํŠธ๊ฐ€ ๋‚˜์˜ด ๊ฑฐ๊ธฐ์„œ ํ”Œ๋ ˆ์ด์–ด๋ฅผ ํด๋ฆญ.

 

์ถœ์ฒ˜: 

https://luv-n-interest.tistory.com/675

 

์นด๋ฉ”๋ผ ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๊ณ ์ •ํ•˜๊ธฐ, Unity 3D

GameObject๋Š” ์›€์ง์ด๋Š”๋ฐ ์นด๋ฉ”๋ผ๋Š” ์›€์ง์ด์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค. ๊ทธ๋Ÿด ๋•Œ ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ• ๊นŒ? ๋งˆ์น˜ ์ด๋ ‡๊ฒŒ.. Main Camera๋ฅผ ์–ด๋–ป๊ฒŒ์ข€ ํ•ด์•ผ๊ฒ ์ง€..? ๊ทธ๋ž˜์„œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ํ•˜๋‚˜ ๋งŒ๋“ค์ž. "FollowPlayer"๋ผ๊ณ  ์ด๋ฆ„์ง€์–ด

luv-n-interest.tistory.com

 

728x90
๋ฐ˜์‘ํ˜•