2020. 10. 31. 18:40
공학기술
'공학기술' 카테고리의 다른 글
기계부품 자료 모음 (0) | 2020.11.10 |
---|---|
mpu6050 (0) | 2020.10.28 |
발진기 (0) | 2020.10.28 |
기계부품 자료 모음 (0) | 2020.11.10 |
---|---|
mpu6050 (0) | 2020.10.28 |
발진기 (0) | 2020.10.28 |
윈폼의 Debug로그이다.
System.Diagnostics.Debug.WriteLine("디버그 메세지");
팝업띄우는 버전
System.Windows.Forms.MessageBox.Show("디버그 메세지");
윈폼 리퀘스트
//v2
public static string DownloadText(string url)
{
try
{
var webClient = new System.Net.WebClient();
return webClient.DownloadString(url);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return null;
}
}
//v1
/*
public static string DownloadText(string url)
{
try
{
var webClient = new System.Net.WebClient();
var response = webClient.OpenRead(url);
using (var streamReader = new System.IO.StreamReader(response))
{
string result = streamReader.ReadToEnd();
streamReader.Close();
return result;
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return null;
}
}
*/
현재 컴퓨터 유저 이름을 반환합니다.
System.Environment.UserName
Lerp
double Lerp(double a,double b,double t)
{
//return a*(1.0-t)+b*t;
return a + (b - a)* t;
}
Vector3 Lerp(Vector3 a, Vector3 b, float t)
{
return a + (b - a)* t;
}
새창 띄울때
var form = Application.OpenForms[nameof(Form2_Prediction)];
if (form==null)
{
form = new Form2_Prediction();
form.Show();
}
else
{
form.Activate();
}
프로세스 확인 (unity가 켜져있는지 확인하는 코드이다)
var processes=System.Diagnostics.Process.GetProcesses();
var processesNames = System.Array.ConvertAll(processes, x => x.HasExited ?"": x.ProcessName).ToList();
processesNames = processesNames.GroupBy(x=>x).Select(x=>x.First()).ToList();
processesNames = processesNames.FindAll(x => string.IsNullOrWhiteSpace(x) == false);
processesNames = processesNames.FindAll(x => x.ToLower().Contains("unity"));
foreach (var processesName in processesNames)
{
Debug.Log(processesName);
}
콤보박스에 Enum 할당
var ProportionalOptionNames = System.Enum.GetNames(typeof(ProportionalOption));
ProportionalOptionBoxs[i].Items.AddRange(ProportionalOptionNames);
window form
.net
닷넷
c# 멀티스레드 기본소스 (0) | 2020.11.23 |
---|---|
c# 윈도우 폼 (0) | 2018.01.28 |
OPENCV 오류 (0) | 2017.11.19 |
떼었을때 작동하는 온클릭을 눌렀을때 작동하는 버튼으로 바꿔줌
할당후에 온클릭은 지워주면 된다
유니티 아틀라스 이미지 깨질때 (0) | 2020.11.09 |
---|---|
유니티 내비게이션 navigation (0) | 2020.10.25 |
TTS (0) | 2020.10.19 |
사진의 위쪽이 정면이
절전모드 해제 방지 (0) | 2020.10.31 |
---|---|
발진기 (0) | 2020.10.28 |
안드로이드 스튜디오 앱 업로드 (0) | 2020.10.19 |
mpu6050 (0) | 2020.10.28 |
---|---|
안드로이드 스튜디오 앱 업로드 (0) | 2020.10.19 |
HDclone 사용법 (0) | 2020.09.03 |
스탠다드 에셋 방식
먼저 스탠다드 에셋을 다운받는다
3D모델의 애니메이터가 있는 최상단에 ThirdPersonAnimatorController를 넣는다
AI캐릭터 컨트롤을 넣고 이동하고자 하는 지점의 트랜스폼을 넣는다
Third Person Character의 Ground Check Distance값을 0.2로 수정한다.
왜냐하면 기본값은 Ground Check Distance가 너무 작아서 지면판정이 안되기 때문이다
Window-> AI/Navigation을 누른다
베이크 하면 완료된다
커스텀 방식
AIControl 코드
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class AIControl : MonoBehaviour
{
public Transform target;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
var agent = GetComponent<NavMeshAgent>();
if ((target != null)&& (agent != null))
{
agent.SetDestination(target.position);
}
}
}
저렇게 배치하고 AIControl을 넣는다