2012년 12월 29일 토요일

CMake Could not create named generator Visual Studio

If you already installed Cygwin with cmake package, cmake command will execute in cygwin which does not support Visual Studio.

In this case, modify cmake command to full path of cmake like "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe".

2012년 12월 23일 일요일

Unity3D Rotate GameObject with mouse

using UnityEngine;
using System.Collections;

public class RotateWithMouse : MonoBehaviour {
 
 public float sensitivityX = 15.0f;
 public float sensitivityY = 15.0f;
 private Transform cameraTm;
 
 public bool down = false;

 // Use this for initialization
 void Start ()
 {
  cameraTm = Camera.mainCamera.transform;
 }
 
 // Update is called once per frame
 void Update () {
  if( Input.GetMouseButtonDown( 0 ) )
   down = true;
  else if( Input.GetMouseButtonUp( 0 ) )
   down = false;
  
  if( down )
  {
   float rotationX = Input.GetAxis("Mouse X") * sensitivityX;
   float rotationY = Input.GetAxis("Mouse Y") * sensitivityY;
   transform.RotateAroundLocal( cameraTm.up, -Mathf.Deg2Rad * rotationX );
   transform.RotateAroundLocal( cameraTm.right, Mathf.Deg2Rad * rotationY );
  }
 }
}