1)Back key event
2) Object touch event
3) LookAtCamera.js
function Update(){ if ( Application.platform == RuntimePlatform.Android ){ if (Input.GetKey(KeyCode.Escape)){ Application.Quit(); } } }
function Update () { TapSelected(); } function TapSelected() { for ( var touch : Touch in Input.touches) { if (touch.phase == TouchPhase.Began) { var ray : Ray = Camera.main.ScreenPointToRay(touch.position); var hit : RaycastHit; if (Physics.Raycast(ray, hit)) { print("selected"); hit.transform.SendMessage("Selected"); }else{ print("unselected"); } } } }
.js var whoToLookAt : Transform; var smoothTime : float = 0.3; private var yVelocity = 0.0; var distanceAbove: float = 0.4; var distanceAway = -1; function LateUpdate( ) { /* transform the camera so it is a distance away from target */ transform.position = whoToLookAt.position + Vector3(0, distanceAbove, distanceAway); /* Look at the target */ //transform.LookAt( whoToLookAt ); } /* LateUpdate */
No comments:
Post a Comment