Switching between the animation camera parade imported in 3dmax and the main camera

Source: Internet
Author: User

Add script location

First person Controller: add the cameraswitch script

Graphic

Maincamera

Animationcamera: import from 3dmax and add the cameraswitch script

The lower-layer object camera is created and used as a subobject.

 

 

CameraswitchCode:

VaR camera1: camera;
VaR camera2: camera;
// Var customskin: guiskin;
Private var programegoon: Boolean = true;

/* Function start (){

Programegoon = true;
// Mouselook1 = getcomponent ("mousecameracsharp ");

}*/
function Update () {
If (programegoon)
{< br> camera1.enabled = true;
camera2.enabled = false;
programegoon = false;
}< br> var fpswalker: fpswalker = getcomponent (fpswalker);
var mousecontrol = getcomponent ("rightmousecontrol ");
If (camera1.enabled)
{< br> mousecontrol. enabled = true;
fpswalker. enabled = true;
}< br> If (! Camera1.enabled)
{< br> mousecontrol. enabled = false;
fpswalker. enabled = false;
}< BR >}< br> function ongui () {
// GUI. skin = customskin;
GUI. box (rect (10, 10,), "camera switch");

// Make the first button. If it is pressed, application. loadlevel (1) will be executed
If (GUI. Button (rect (20, 40, 80, 20), "Camera 1 ")){
Camera1.enabled = true;
Camera2.enabled = false;
}
// Make the second button.
If (GUI. Button (rect (20, 70, 80, 20), "Camera 2 ")){
Camera1.enabled = false;
Camera2.enabled = true;
}

}

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.