Hi
I have this script I would like to use in Unity iphone. This script makes the camera rotate around the target everytime I touch the screen. However the game I am making is a touch screen game, meaning everytime I am trying to play the game the screen rotates. I want to be able to have 2 buttons on the screen that could be touched. One button running this script and another running this script but turning in the other direction. How would I do this?
(credit noradninja for this script)
//////////////////////////////////////////////////////////////
//This code is derived from: FollowTransform.js
// Penelope iPhone Tutorial
//
// FollowTransform will follow any assigned Transform and
// optionally face the forward vector to match for the Transform
// where this script is attached.
//////////////////////////////////////////////////////////////
var FollowObject : Transform; // Transform to follow
var RotatingObject : Transform; // Transform to follow
var faceForward : boolean = false; // Match forward vector?
private var thisTransform : Transform;
function Start()
{
// Cache component lookup at startup instead of doing this every frame
thisTransform = transform;
}
function Update ()
{
thisTransform.position = FollowObject.position;
if(iPhoneInput.touchCount == 1){
Debug.Log ("this is working");
transform.RotateAround (RotatingObject.position, RotatingObject.up, 5);
}
}
asked
May 10 '10 at 09:17 AM
Sunnee
1
●
1
●
1
●
1