Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Benjeta · Jul 19, 2014 at 08:27 AM · cameratriggermousemove

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 ^^

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Benjeta · Jul 19, 2014 at 09:53 AM 0
Share

Sure ! I accept anything. If your script can switch camera I'll take him. ;) And for allowing us to control the FPC with mouse ? :/

avatar image Benjeta · Jul 19, 2014 at 10:09 AM 0
Share

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

avatar image GlorifiedPig · Jul 19, 2014 at 10:24 AM 0
Share

The mouse can sometimes bug with the resoloution. I had a ragdoll game and it worked perfectly with the mouse

avatar image CScherer549 · Jul 20, 2014 at 07:50 PM 0
Share

Have a separate mouse look on your character that gets turned on when you enter the house while disabling the camera mouse looks.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

24 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges