2015년 11월 19일 목요일
2015년 11월 9일 월요일
2015년 10월 28일 수요일
ngui scroll view 삽질
scroll view에 UIGrid를 이용해서 사용하다가
카톡 친구 리스트를 불러오는데 폰에서 과부하가 걸렷다....
UIGrid 대신에 UIWrapContent를 사용하고
min = -1, max = 0으로 설정해서 원하는 방향으로 구현했다.
하지만 이게 리스트에 Item일 때는 위치가 가운데로 되는 문제가...
이것저것 해보다가 ScrollView에 offset, positon값을 변경하니
progress bar 값이 0으로 설정되서 리스트 상위에 딱 위치한네..
ngui 짜증
카톡 친구 리스트를 불러오는데 폰에서 과부하가 걸렷다....
UIGrid 대신에 UIWrapContent를 사용하고
min = -1, max = 0으로 설정해서 원하는 방향으로 구현했다.
하지만 이게 리스트에 Item일 때는 위치가 가운데로 되는 문제가...
이것저것 해보다가 ScrollView에 offset, positon값을 변경하니
progress bar 값이 0으로 설정되서 리스트 상위에 딱 위치한네..
ngui 짜증
2015년 9월 22일 화요일
2015년 7월 10일 금요일
[Unity3D] PlayerPrefs 저장 위치
MAC OS
ㄴ 어플리케이션 : ~/Library/Preferences
ㄴ 웹플레이어 : ~/Library/Preferences/Unity/WebPlayerPrefs
unity.[company name].[product name].plist 파일
Windows OS
ㄴ 어플리케이션 : 레지스트리 HKCU\Software\
ㄴ 웹플레이어 : %APPDATA%\Unity\WebPlayerPrefs
\[company name]\[product name] 폴더
시작 단추, 실행을 차례로 누르고 REGEDIT를 입력
ㄴ 어플리케이션 : ~/Library/Preferences
ㄴ 웹플레이어 : ~/Library/Preferences/Unity/WebPlayerPrefs
unity.[company name].[product name].plist 파일
Windows OS
ㄴ 어플리케이션 : 레지스트리 HKCU\Software\
ㄴ 웹플레이어 : %APPDATA%\Unity\WebPlayerPrefs
\[company name]\[product name] 폴더
시작 단추, 실행을 차례로 누르고 REGEDIT를 입력
2015년 6월 28일 일요일
Unity 모바일 터치 관련
1. 터치된 손가락 갯수 인식하기
// 손가락 터치가 1개 일때
if(Input.touchCount == 1){ ... }
// 손가락 터치가 2개 이상일때
if(Input.touchCount >= 2){ ... }
// 손가락 터치가 오직 1개일때만
if(Input.touchCount < 2){ ... }
2. 터치의 단계는 5가지
// 터치가 시작되었을 때
if(Input.GetTouch(0).phase == TouchPhase.Began){ ... }
// 터치된 손가락이 움직일 때
if(Input.GetTouch(0).phase == TouchPhase.Moved){ ... }
// 터치된 손가락이 그자리에 가만히 있을 때
if(Input.GetTouch(0).phase == TouchPhase.Stationary){ ... }
// 터치된 손가락이 스크린에서 떨어질 때
if(Input.GetTouch(0).phase == TouchPhase.Ended){ ... }
// 모바일폰을 귀에 갖다 대거나 touch tracking을 수행하지 않아야 할 경우에
if(Input.GetTouch(0).phase == TouchPhase.Canceled){ ... }
3. 터치의 응용
// 손가락 두 개가 움직일 때
if(Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Moved){ ... }
// 손가락 하나는 가만히 있고 다른 하나는 움직일 때
if(Input.GetTouch(0).phase == TouchPhase.Stationary && Input.GetTouch(1).phase == TouchPhase.Moved){ ... }
// 손가락 한 개가 스크린을 움직일 때 속도
if(Input.GetTouch(0).phase == TouchPhase.Moved){
float speedX = Input.GetTouch(0).deltaPosition.x / Input.GetTouch(0).deltaTime; // 횡방향 속도
float speedY = Input.GetTouch(0).deltaPosition.y / Input.GetTouch(0).deltaTime; // 종방향 속도
}
// 스크린 찍은 위치에서 Raycast 할 때
if(Input.GetTouch(0).phase == TouchPhase.Began){
Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
RaycastHit hit;
if(Physics.Raycast(ray, out hit, 10.0f)){
Instantiate(something, hit.point, Quaternion.identity);
}
}
2015년 3월 3일 화요일
nev mesh 설정 예제
http://unitykorea.wisaweb.co.kr/board/index.php?db=knowhow&no=715&mari_mode=view@view&cate=&page=1&listURL=http%3A%2F%2Funitykorea.wisaweb.co.kr%2Fboard%2F%3Fdb%3Dknowhow&search=&search_str=&temp=
간단간단허네에
간단간단허네에
유니티 최적화 총정리 2014년 12월
http://www.slideshare.net/agebreak/141206-42456391?related=1
PPT자료인데 이제까지 찾았던 유니티 최적화 이슈를 잘 모아서 발표한신 것 같음
좋은 자료네요
PPT자료인데 이제까지 찾았던 유니티 최적화 이슈를 잘 모아서 발표한신 것 같음
좋은 자료네요
2015년 2월 22일 일요일
2015년 2월 12일 목요일
[Unity3D] 마우스로 객체 드래그하기 (DragGameObject)
게임상에서 테스트 용도로 객체를 마우스로 이동시키고 싶을 때, 사용하기 편하게 해주는 스크립트입니다. Procedural 예제에 있던 겁니다.
사용법은 아래의 코드로 생성된 스크립트 파일을 원하는 객체에 드래그 해주시면 됩니다. 쉽죠.
사용법은 아래의 코드로 생성된 스크립트 파일을 원하는 객체에 드래그 해주시면 됩니다. 쉽죠.
using UnityEngine;
using System.Collections;
public class DragGameObject : MonoBehaviour {
IEnumerator OnMouseDown()
{
Vector3 scrSpace = Camera.main.WorldToScreenPoint (transform.position);
Vector3 offset = transform.position - Camera.main.ScreenToWorldPoint (new Vector3 (Input.mousePosition.x, Input.mousePosition.y, scrSpace.z));
while (Input.GetMouseButton(0))
{
Vector3 curScreenSpace = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, scrSpace.z);<br>
Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenSpace) + offset;
transform.position = curPosition;
yield return null;
}
}
}
(http://kpro.tistory.com/80)
2015년 2월 10일 화요일
애니메이션 본 최적화
바이패드 복사 본 만들기 ver0.2
bips = #()
bons = #() boneName = "" boundingBox = undefined bipLength = undefined bipwidth = undefined bipheight = undefined objs = selection as array fn changeName strs oldStr newStr = ( findFlag = findstring strs oldStr if (findFlag != undefined) do ( changeStr = replace strs findFlag oldStr.count newStr ) changeStr ) for i = 1 to objs.count do ( if((classof objs[i] == Biped_Object) and (objs[i].name != "Bip01 Footsteps")) do append bips objs[i] ) clearSelection() for i = 1 to bips.count do ( boneName = bips[i].name boneName = changeName boneName "bip" "bone" boundingBox = nodeGetBoundingBox bips[i]bips[i].transform bipLength = boundingBox[2].x bipheight = boundingBox[2].y bipwidth = boundingBox[2].z madeBone = Bonesys.createBone[0,0,0][1,0,0][0,0,1] madeBone.name = boneName madeBone.width = bipWidth madeBone.height = bipheight madeBone.length = bipLength madeBone.boxmode = on madeBone.rotation = (inverse(biped.getTransform bips[i] #rotation)) madeBone.position = (bips[i].transform.pos) madeBone.position.controller = Position_Constraint() madeBone.position.controller.appendTarget bips[i] 50.0 madeBone.rotation.controller= Orientation_Constraint() madeBone.rotation.controller.appendTarget bips[i] 50.0 append bons madeBone ) for i = 1 to bips.count do ( if(bips[i].parent != undefined) do ( parentBip = bips[i].parent boneName = parentBip.name boneName = changeName boneName "bip" "bone" bons[i].parent = execute("$'" + boneName + "'") ) ) select bons 사용법은 1. 바이패드를 생성한 후에 선택을 한다. 2. 스크립트를 실행하면 바이패드선택이 해제 되고 흉내내기 본이 만들어진 후에 본이 선택된다. 3. 구조는 'Bip01 Footsteps'을 제외하고 모두 동일하다. 4. 노드의 이름은 'Bip'를 'Bone'로 변경하고 나머지는 동일하게 생성한다. 5. 기본적으로 바이패드의 링크 구조를 따르면서 바이패드를 움직이면 본이 따라 움직인다. 6. 바이패드 일부만 선택하고 실행해도
8. 링크 구조도 정상적으로 생성된다.
|
피드 구독하기:
글 (Atom)







