FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Share

descriptionResident 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

descriptionRe: Resident Evil Cam Swap

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

--New Developer

_________________
Serious, Focused but FUN.

descriptionRe: Resident Evil Cam Swap

more_horiz
[You must be registered and logged in to see this link.] wrote:
Hey, could you please post a description each time you make a post.

--New Developer


Added.

descriptionRe: Resident Evil Cam Swap

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

Wooden

descriptionRe: 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

description iam new

more_horiz
will any one teach e me how to work on unity
Permissions in this forum:
You cannot reply to topics in this forum