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
1
Question by peacemaker · Oct 24, 2010 at 05:12 PM · charactercontrollermousemouselook

Turning off character control when window open

I'm trying to ignore all user input when my inventory window is open and am having some problems with it.

Here is the code I'm using:

public void AllowPlayerControl(bool allowControl)
{
    CharacterMotor motor = GetComponent<CharacterMotor>();
    MouseLook mouseLook = GetComponent<MouseLook>();
    motor.enabled = allowControl;
    mouseLook.enabled = allowControl;
}

This works in stopping the player moving the character and horizonal mouse movement but the player is still able to move the mouse vertically. The character controller itself was taken directly from the standard assets scripts for first person controller. What else do I need to disable to fix this?

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by jashan · Oct 24, 2010 at 06:25 PM

One approach to finding out what is missing: While playing, have a look at the hierarchy and inspect the objects that might be relevant (cameras, player objects) and see which components are attached. Then disable those and see if it has the desired effect.

Another approach: Code review ... review your code to find out what is causing the effect of vertical mouse-movement. Then disable that.

Comment
Add comment · Show 2 · 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 peacemaker · Oct 26, 2010 at 10:39 AM 0
Share

I've disabled every script attached to the character. Is there any way of disabling the CharacterController component? I can't see any 'Active' or 'Enabled' properties in the scripting reference...

avatar image jashan · Oct 27, 2010 at 06:31 AM 0
Share

As the CharacterController is just a kind of collider, it shouldn't be the thing causing your problems. Can you edit your question and include the scene hierarchy? If the scene hierarchy is too complex to post here, you might try creating a simple repro case (that's usually also a good way to find out what the problem is - but it's also often a bit of work): Create the simplest possible scene that shows the unwanted behavior you see. Also, it might be interesting to see the implementation of $$anonymous$$ouseLook (it's probably the most likely candidate for the trouble).

avatar image
0

Answer by Drakmyth · Dec 27, 2012 at 10:21 PM

The MouseLook script on the First Person Controller handles horizontal rotation, but there is also a MouseLook script attached to the Main Camera inside the First Person Controller that handles the vertical rotation. This is because when you look left/right the entire First Person Controller rotates, but when you look up/down, only the camera rotates.

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

1 Person is following this question.

avatar image

Related Questions

Mouse movement swings character around in circles 1 Answer

How can I save MouseLook position in this script ? 0 Answers

rotate player towards the mous 1 Answer

How to Disable Mouse and Character movement? (Javascript) 1 Answer

Why does my mouselook sensitivity change depending on resolution? (C#) 1 Answer


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