UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionResident Evil Cam Swap EmptyResident Evil Cam Swap

more_horiz
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

descriptionResident Evil Cam Swap EmptyRe: Resident Evil Cam Swap

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

--New Developer

descriptionResident Evil Cam Swap EmptyRe: Resident Evil Cam Swap

more_horiz
NewDeveloper wrote:
Hey, could you please post a description each time you make a post.

--New Developer


Added.

descriptionResident Evil Cam Swap EmptyRe: Resident Evil Cam Swap

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

Wooden

descriptionResident Evil Cam Swap EmptyRe: Resident Evil Cam Swap

more_horiz
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

descriptionResident Evil Cam Swap Empty iam new

more_horiz
will any one teach e me how to work on unity

descriptionResident Evil Cam Swap EmptyRe: Resident Evil Cam Swap

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply