Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » FREE Project Downloads & Recources » Scripts » Resident Evil Cam Swap

Resident Evil Cam Swap

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Resident Evil Cam Swap on Thu Sep 04, 2014 4:29 pm

Ninjaboy follower


Member [Lv. 3]
Member [Lv. 3]
Each time the object collides with player it swaps(enables and disables) the two cameras.
Attach this script to an empty game object, It's a simple script.
Code:

#pragma strict

var cam1 : Camera;
var cam2 : Camera;

private var walkedIn : boolean = false;

function Start()
{
 cam1.camera.enabled = true;
 cam2.camera.enabled = false;
}

function OnTriggerEnter(Col : Collider)
{
 if(Col.tag == "Player")
 {
 walkedIn = !walkedIn;
 }
}

function Update()
{
 if(walkedIn == true)
 {
 cam1.camera.enabled = false;
 cam2.camera.enabled = true;
 }
 
 if(walkedIn == false)
 {
 cam1.camera.enabled = true;
 cam2.camera.enabled = false;
 }
}



Last edited by Ninjaboy follower on Fri Sep 05, 2014 12:00 am; edited 1 time in total

View user profile

2 Re: Resident Evil Cam Swap on Thu Sep 04, 2014 5:56 pm

NewDeveloper


Moderator
Moderator
Hey, could you please post a description each time you make a post.

--New Developer

View user profile

3 Re: Resident Evil Cam Swap on Fri Sep 05, 2014 12:03 am

Ninjaboy follower


Member [Lv. 3]
Member [Lv. 3]
NewDeveloper wrote:Hey, could you please post a description each time you make a post.

--New Developer

Added.

View user profile

4 Re: Resident Evil Cam Swap on Fri Sep 05, 2014 5:50 pm

DeveloperLuke


Moderator
Moderator
Thanks for the cool script looks pretty simple to me Very Happy But thanks for sharing

Wooden

View user profile

5 Re: Resident Evil Cam Swap on Sat Dec 27, 2014 6:37 am

BK201


Member [Lv. 1]
Member [Lv. 1]
i dont know you script please teac me
im beginner
Smile
first im instal unity 3.2.0
unity 3.2.0 and unity 4.3.0 same or no ?
please help me for beginner use unity Smile

View user profile

6 iam new on Fri Mar 06, 2015 11:01 am

nishad


Member [Lv. 0]
Member [Lv. 0]
will any one teach e me how to work on unity

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum