- Home /
Keep the mouse move for FPC
Hi, question again.
I'm making a First Person game. In a house I've some "Resident Evil" screens (Fixeds Cameras)
The script : #pragma strict
var camera1 : GameObject;
var camera2 : GameObject;
function OnTriggerEnter (other : Collider) {
if (other.tag == "Player"){
camera1.gameObject.active = false;
camera2.gameObject.active = true;
}
}
function OnTriggerExit (other : Collider) {
if (other.tag == "Player"){
camera1.gameObject.active = true;
camera2.gameObject.active = false;
}
}
He disable the FPC Camera and activate the fixed camera when entering trigger. BUT, i'm not able to move the character with the mouse when I'm on the fixed camera trigger. How to keep the mouse control ? Thanks ^^
Sure ! I accept anything. If your script can switch camera I'll take him. ;) And for allowing us to control the FPC with mouse ? :/
Hm, thanks, try this right now but, it's ontrigger enter and exit. Not on key press. I'll correct him ^^ I'll be back once I've finished testing your script EDIT : Nope, I'm unable to orient the character with the mouse
The mouse can sometimes bug with the resoloution. I had a ragdoll game and it worked perfectly with the mouse
Have a separate mouse look on your character that gets turned on when you enter the house while disabling the camera mouse looks.
Answer by GlorifiedPig · Jul 19, 2014 at 10:03 AM
Yes, sorry for late reply.
var cam1 : Camera; // Main camera
var cam2 : Camera; // Camera to be switched to
function Start() {
cam1.enabled = true; // Enable main camera at start
cam2.enabled = false; // Disable secondary camera
}
function Update() {
if (Input.GetKeyDown(KeyCode.C)) { // What button to be pressed
cam1.enabled = !cam1.enabled;
cam2.enabled = !cam2.enabled;
}
}
That's for it. Cam1 = main camera Cam2 = camera to be switched too. You should be able to switch and move now.
Answer by Benjeta · Jul 19, 2014 at 10:44 AM
The problem is : I've a FPC and ALL the game use First Person view. Only on one house I've planed to make 3 Statics Cameras. When the camera on the NPC switch to the fixed one, my chracter still controlable BUT only with the WASD keys, not the mouse, so to turn around it's impossible. My only option is to control the character with WASD.
Your answer
Follow this Question
Related Questions
C# move main camra via mouse position on boarders around screen script for RTS Game 0 Answers
how to do to run or activate an action with the click of a mouse? 1 Answer
Problem with Alt + Middle Click Drag for Camera (Windows) 3 Answers
Raycast Object Selection 3 Answers
How to make your character move? 7 Answers