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 ratmstein · Apr 19, 2014 at 12:20 AM · mouse look

How do I use mouse look for my FPS?

I've looked around and cannot seem to find a simple how to on mouse look. I'm making a FPS and I would like to look around with the mouse. I have a FP Controller with mouse look C# attached with mouseX as axes. Then my main camera(which is a child of the FP controller) has mouse look C# attached with mouseY as the axes. Now when I play my game the camera does not follow the mouse. Can anyone help? The only tutorials I see are about writing my own mouse look script.

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 getyour411 · Apr 19, 2014 at 12:20 AM 0
Share

Check your tags on main camera and player

avatar image ratmstein · Apr 20, 2014 at 05:21 PM 0
Share

$$anonymous$$y First Person Controller is tagged as "Player" and $$anonymous$$ain Camera is tagged as "$$anonymous$$ainCamera".

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by SteelArrow21 · Apr 19, 2014 at 12:50 AM

If you imported all the packages, there should be a script that allows you to look around in FPS. When you test the game however, your cursor will go off screen while the FPS is still looking around. If you run a build, that would not be the case.

Comment
Add comment · Show 1 · 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 ratmstein · Apr 20, 2014 at 05:21 PM 0
Share

I have the $$anonymous$$ouseLook script and HideCursor script attached to my First Person Controller, and have followed the directions that are in the $$anonymous$$ouseLook script.

avatar image
0

Answer by BeginnerPlzHelp · Nov 03, 2020 at 03:38 PM

@ratmstein

So if you need any more help just ask me, I'm a beginner coder but i know some things so this is my Mouse Look script, it comes with a tutorial on what to do in unity as well,

UNITY TUTORIAL so in unity create an empty object > make it a parent of the main cam > give the empty object a character controller component > then apply a "cylinder" body to it to make it actually visible.

SCRIPT (make sure you apply this script to the main camera that is on the player, you don't wanna have it on the empty object)

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class MouseLook : MonoBehaviour {

 public float mouseSensitivity = 100f;

 public Transform playerBody;

 float xRotation = 0f;

 // Start is called before the first frame update
 void Start()
 {
     Cursor.lockState = CursorLockMode.Locked;
 }

 // Update is called once per frame
 void Update()
 {
     float MouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
     float MouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

     xRotation -= MouseY;
     xRotation = Mathf.Clamp(xRotation, -90, 90);

     transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
     playerBody.Rotate(Vector3.up * MouseX);
 }

}

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 RealEfrain12 · Nov 22, 2020 at 02:24 AM 0
Share

From what I've heard, you need Unity 2019.4, also to look sideways doesn't work but looking up and down does (this is just what I'm experiencing)

avatar image BeginnerPlzHelp · Nov 22, 2020 at 06:24 PM 0
Share

@RealEfrain12 R u talking to me?

avatar image
0

Answer by RealEfrain12 · Dec 07, 2020 at 12:57 PM

@BeginnerPlzHelp yeah, well more specifically I’m talking about how this is working, also I know this code, it’s from Brackeys, and yes how do I know? It’s because I used the same exact code

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

23 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

Related Questions

Turret on Tank rotating fine until I'm not flat on ground 1 Answer

Top down shooter mouse look (3d) 2 Answers

How do i make camera movement smoother? 1 Answer

Editting standart charcontroller 0 Answers

C# Crosshair 4 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