본문 바로가기

-/Unity3D 5.x17

유니티3D, 가속도 센서 Input.acceleration - 3차원 공간에서의 기기의 최근 선형 움직임 값을 측정. (읽기전용) 12345678910111213141516using UnityEngine;using System.Collections; public class ExampleClass : MonoBehaviour { public float speed = 10.0F; void Update() { Vector3 dir = Vector3.zero; dir.x = -Input.acceleration.y; dir.z = Input.acceleration.x; if (dir.sqrMagnitude > 1) dir.Normalize(); dir *= Time.deltaTime; transform.Translate(dir * spe.. 2015. 5. 14.
화면에서 마우스 클릭한 위치 Ray 정보, 디버그레이 1234if ( Input.GetMouseButton(0) ) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Debug.DrawRay(ray.origin, ray.direction*100f, Color.red);}Colored by Color Scriptercs 2015. 5. 12.
유니티3D, Mathf 공식 문서 : http://docs.unity3d.com/ScriptReference/Mathf.html Mathf.Abs() Mathf.Acos()Mathf.Asin()Mathf.Atan()Mathf.Atan2() Mathf.Max()Mathf.Min() Mathf.Log()Mathf.Log10() Mathf.Pow() Mathf.Cos()Mathf.Sin()Mathf.Tan() Mathf.Sqrt() 2015. 5. 12.
유니티3D, Invoke함수 MonoBehaviour.Invoke#Invoke http://docs.unity3d.com/ScriptReference/MonoBehaviour.Invoke.html MonoBehaviour.InvokeRepeatinghttp://docs.unity3d.com/ScriptReference/MonoBehaviour.InvokeRepeating.html MonoBehaviour.CancelInvokehttp://docs.unity3d.com/ScriptReference/MonoBehaviour.CancelInvoke.html MonoBehaviour.IsInvokinghttp://docs.unity3d.com/ScriptReference/MonoBehaviour.IsInvoking.html 2015. 4. 9.
유니티3D, 코루틴(Couroutine) 예제 1234567891011121314using UnityEngine;using System.Collections; public class ExampleClass : MonoBehaviour { void Start() { print("Starting " + Time.time); StartCoroutine(WaitAndPrint(2.0F)); print("Before WaitAndPrint Finishes " + Time.time); } IEnumerator WaitAndPrint(float waitTime) { yield return new WaitForSeconds(waitTime); print("WaitAndPrint " + Time.time); }}Colored by Color Scriptercs 12.. 2015. 4. 9.
LitJSON은 float 을 지원하지 않는 것으로 보인다. LitJSON Limitations/WarningsThe library seems pretty good, but a few major things I've noticed when serializing/deserializing a class:LitJSON only outputs/inputs public variables.Not a bad thing necessarily - you might like to use private for things you don't want output.LitJSON outputs (public) const values, but will (not suprisingly) fail trying to import consts.You may need to move these cons.. 2015. 3. 5.
320x100