Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Project_BP · Oct 08, 2015 at 01:20 AM · scripting problemmouselookfps controller

Change standart FirstPersonController variables via other script

Hello Guys,

im using the standart FPS controller script. I would like to disable the MouseX and MouseY axis but not able to find the correct reference in the C# code. All the other inputs should still be active. The charecter have to be able to move but not to look around with the mouse. Right now i an disabeling the whole script. Im writing Javascript.

what am i doing right now

  FPSController.GetComponent("FirstPersonController").enabled = false;

what i would like to do (pseudocode)

  FPSController.GetComponent("FirstPersonController") GetComponentMouseX = 0 | GetComponentMouseY = 0;

Greetings BP

Comment
Add comment · Show 2
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 Cherno · Oct 08, 2015 at 08:54 AM 0
Share

The FPS Controller prefab has a $$anonymous$$ouseLook script, which is what you are after.

avatar image Project_BP Cherno · Oct 16, 2015 at 08:07 AM 0
Share

Thank you for the answer, alreade searched alot for the solution and always people were talking about the $$anonymous$$ouseLook script. In my Unity5 FPSController is no such thing as a $$anonymous$$ouseLook script. Only the FirstPersonController script with one dropdown part called $$anonymous$$ouseLook inside. So you are saying me to disable the part of the script FirstPersonController called $$anonymous$$ouseLook? alt text

fps.jpg (44.2 kB)

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by rajavamsidhar_gvs · Oct 16, 2015 at 11:00 AM

Attach this script to ur first person. click 1 one for off the controls click 2 for on the mouse controls..

 using UnityEngine;
 using System.Collections;
  public class MouseControls : MonoBehaviour{    
 void Update(){
 if(Input.GetKey(KeyCode.Alpha1))
 
 this.gameObject.GetComponent<MouseLook>().enabled=false;//disabling mouse inputs when u click 1
      if(Input.GetKey(KeyCode.Alpha2))
 this.gameObject.GetComponent<MouseLook>().enabled=true;//enabling mouse inputs when u click 2 
 }
 }


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 Project_BP · Oct 16, 2015 at 05:11 PM 0
Share

Hello and thank you for the reply. Sadly im recieving the following error message. "$$anonymous$$ouseControls.cs(8,54): error CS0246: The type or namespace name `$$anonymous$$ouseLook' could not be found. Are you missing a using directive or an assembly reference?" There is just no "$$anonymous$$ouseLook" script in my FPS controller. The standart assets are importet.

avatar image rajavamsidhar_gvs Project_BP · Oct 17, 2015 at 04:29 AM 0
Share

it is saying it dont have the mouselook.cs. tell me first how many scripts are there to firstperson.and what are they.then i'll modify my answer..

avatar image
0

Answer by MajorParts · Oct 17, 2015 at 11:38 AM

See my comments here... (C# but may give you clues)

access fps variables

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

6 People are following this question.

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

Related Questions

First Person Player 3 Answers

Object reference not set to an instance of an object. ( FirstPersonController) 1 Answer

No Y-Axis rotation FPS Controller 2 Answers

FPS Controller and crawling on Walls/Ceiling 0 Answers

Jittery FPS Camera when moving 3 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