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 ijmusic12 · Feb 08, 2019 at 04:07 AM · cameraunityeditorcamera-movementcamera-look

Camera movement doesn't work in Unity (but does in builds)

Hi all,

I've had a nice little third-person character and camera controller system that I made from scratch running in my game for a few days now. Today I added a plane with a gaussian blur shader that is a child of the camera (which is a child of the character) so when the blur is made non-zero, everything the camera sees is blurry! Seems simple enough. And it was! I had a working prototype so I published my changes to the cloud and left Unity for a little bit.

Upon returning, my character simply will not rotate on the horizontal (Y) axis. Not if I restore to the (working!) version I had published a few hours ago, not if I hard-code a non-zero rotation into a script, not if I try to change the Y-rotation in the inspector while the game is running, and definitely not when I use the arrow keys or mouse (the up/down mouse look, however, still functions)! I've tried every debugging trick in my power, including starting from a much earlier and completely functional version and reimplementing the plane in front of the camera. But upon restarting Unity, the same glitch occurs. The worst part: when I build and run my application, there are no issues. Everything works exactly as intended! But obviously this is a significant part of the movement mechanic in my game and it's necessary that the game be playable from within unity as we continue development. Does anyone have any idea what could be going on? I've been spinning my wheels for quite some time now.

Here's the camera controller code (which handles rotating the player):

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class thirdPersonCamera : MonoBehaviour
 {
     Vector2 mouseLook;
     Vector2 smoothV;
     public float sensitivity;
     public float smoothing;
     public GameObject character;
     private float spellCastMod;
     private firstPersonCharacterControl charObj;
     private float rotate;
     // Start is called before the first frame update
     void Start()
     {
         charObj = FindObjectOfType<firstPersonCharacterControl>();
         character = charObj.gameObject;
         rotate = 0;
 
     }
 
     // Update is called once per frame
     void Update()
     {
         if (levelChanger.levelRunning) //conditions for game running
         {
             Vector2 mouseDelta;
 
             mouseDelta = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
             if (spellCaster.spellCastWindowActive) spellCastMod = .1f;
             else spellCastMod = 1;
             mouseDelta *= sensitivity * smoothing * spellCastMod;
             smoothV.x = Mathf.Lerp(smoothV.x, mouseDelta.x, 1f / smoothing);
             smoothV.y = Mathf.Lerp(smoothV.y, mouseDelta.y, 1f / smoothing);
 
             mouseLook += smoothV;
             float x = Input.GetAxis("Horizontal") * charObj.speed * Time.deltaTime;
             transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);
             rotate += x * 8;
             character.transform.localRotation *= Quaternion.AngleAxis(rotate + mouseLook.x, character.transform.up);
         }
     }
 }


Thank you so much!!

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

0 Replies

· Add your reply
  • Sort: 

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

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

clamping camera movement to map size and camera corners 0 Answers

How to have free rotation camera? 1 Answer

Getting the camera to move in the direction its facing. 0 Answers

camera movments fixed.. character controller without using character controller -.-' 2 Answers

Camera to move when i move to the next room 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