Commit 3db50494 authored by 18손재민's avatar 18손재민 Committed by 18류지석

맵 에디터 새로 만드는 중, 현재 마우스가 가리키는 위치에 소환하고자 하는 오브젝트의 위치가 표시되도록 하는 기능 구현

parent 201277f9
This diff is collapsed.
fileFormatVersion: 2
guid: d497e786cde06654d95b00ea985c6d2a
guid: a4703a8cf8791c8478df829ae310e76f
DefaultImporter:
externalObjects: {}
userData:
......
This diff is collapsed.
fileFormatVersion: 2
guid: d497e786cde06654d95b00ea985c6d2a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a0d005a767fd8f143813d012b66c4ad7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TempMapEditor : MonoBehaviour
{
public GameObject test;
Vector3 GetMousePoint(bool isFloat = false, bool isAtPoint = false)
{
Vector3 originPos = Camera.main.ScreenPointToRay(Input.mousePosition).origin;
Vector3 mousePoint = new Vector3(Mathf.Round(originPos.x - (isFloat ? 0.5f : 0)) + (isFloat ? 0.5f : 0), 0,
Mathf.Round(originPos.z - (isFloat ? 0.5f : 0)) + (isFloat ? 0.5f : 0));
if (!isAtPoint)
{
if(Mathf.Abs(originPos.x - mousePoint.x) > Mathf.Abs(originPos.z - mousePoint.z)) mousePoint = new Vector3(Mathf.Round(mousePoint.x), 0, mousePoint.z);
else mousePoint = new Vector3(mousePoint.x, 0, Mathf.Round(mousePoint.z));
}
return mousePoint;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
test.transform.position = GetMousePoint(true, false);
}
}
fileFormatVersion: 2
guid: 9a746a781dac85f4e83d53535a073dfc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment