로딩
티스토리 데이터 처리 중입니다.

유니티 C# 자석 효과 Magnet 간단 구현

 유니티 C# 자석 효과 Magnet 간단 구현

코드 작성 (적용하고 싶은 오브젝트에 적용) using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Example : MonoBehaviour { public Transform target; public float moveSpeed = 1.0f; private void Update() { Vector2 relativePos = target.transform.position - transform.position; float angle = Mathf.Atan2(relativePos.y, relativePos.x) * Mathf.Rad2Deg; transform......