NOTE/SaveSource19 [SaveSource] Touch Pinch Zoom /* touch pinch zoom */ if (Input.touchCount == 2) { touchZero = Input.GetTouch(0); touchOne = Input.GetTouch(1); touchZeroPrevPos = touchZero.position - touchZero.deltaPosition; touchOnePrevPos = touchOne.position - touchOne.deltaPosition; prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude; touchDeltaMag = (touchZero.position - touchOne.position).magnitude; deltaMagnitudeDiff = p.. 2016. 10. 14. [SaveSource] Player Cam & Input.Axis [PlayerCtrl.cs] - 캐릭터에 부착 public class PlayerCtrl : MonoBehaviour { public float moveSpeed = 10; void Update () { float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); transform.Translate(new Vector3(h, 0, v) * moveSpeed * Time.deltaTime); transform.Rotate(new Vector3(0, Input.GetAxis("Mouse X"), 0)); } } [FollowCam.cs] - 카메라에 부착, Target에 캐릭터 부착 public class FollowCam : Mon.. 2016. 10. 7. [SaveSource] GyroScope Camera [CameraScene]스마트폰움직임이랑 Unity MainCamera랑 움직임 동일화 1. GyroCamera.cs using UnityEngine; using System.Collections; public class GyroCamera : MonoBehaviour { private Gyroscope gyro; private bool gyroSupported; private Quaternion rotFix; void Start () { gyroSupported = SystemInfo.supportsGyroscope; GameObject camParent = new GameObject("camParent"); camParent.transform.position = transform.position; t.. 2016. 10. 6. 이전 1 2 3 4 5 다음