x


360 camera in Unity iphone

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); 
   } 
} 
more ▼

asked May 10 '10 at 09:17 AM

Sunnee gravatar image

Sunnee
1 1 1 1

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3131
x2014
x747
x105

asked: May 10 '10 at 09:17 AM

Seen: 2506 times

Last Updated: May 10 '10 at 01:47 PM