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 /
  • Help Room /
avatar image
0
Question by zachwuzhere · Feb 27, 2017 at 11:52 AM · rotationrotateeulerangles

Character rotation is jittery

I am trying to write a player controller for my character and for the most part it works but I have a problem with stuttering.

In my hierarchy, The camera is separate from the player, and the CameraPivot and GunPivot are attached to the player.

When I rotate on the Y-axis it seems fine, but rotating my character to look up and down (X-axis) makes the movement of the gun, hands and camera stutter or jitter or out of sync.

I Know there are many other topics on this, but I was not able to find anything that works for this. I have tried using LateUpdate, and FixedUpdate(with Fixed deltatime) (Neither seem to help). Also I have tried quaternion or slerp, but unsure of how to actually implement them into my code.

Any help will be appreciated. Thanks.

 void Update () {
     //Player Move Stuff
         Forwards = (Input.GetAxis("Vertical")) * runspeed * Time.deltaTime;  
         Sideways = (Input.GetAxis("Horizontal")) * sidespeed * Time.deltaTime;  
         transform.Translate( new Vector3 (Sideways, 0, Forwards));
         RotatePlayer = Input.GetAxis ("Mouse X") * TurnSpeed * Time.deltaTime;
         transform.Rotate (new Vector3 (0, RotatePlayer, 0)); //Rotates the player
     //player Camera Stuff
         PlayerCamera.transform.position = new Vector3((CameraPivot.transform.position.x),(CameraPivot.transform.position.y),(CameraPivot.transform.position.z)); //Camera follows the pivot location
         RotateCamY += Input.GetAxis ("Mouse X") * TurnSpeed * Time.deltaTime;    
         RotateCamX += Input.GetAxis ("Mouse Y") * LookUpDownSpeed * Time.deltaTime;    
         RotateCamX = Mathf.Clamp (RotateCamX, Xmin, Xmax);        
         Vector3 PivotVector = new Vector3 (-RotateCamX , RotateCamY+180, 0);
         PlayerCamera.transform.eulerAngles = PivotVector; //Rotates the camera
         CameraPivot.transform.eulerAngles =PivotVector;  //Rotates point the camera is attached to 
         GunPivot.transform.eulerAngles = PivotVector;   //Rotates point the gun is attached to
     }




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

1 Reply

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

Answer by zachwuzhere · Mar 02, 2017 at 02:34 AM

Thanks to all who have helped me thus far, I found out what the problem was.

I rewrote it and now it is smooth as butter!

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Any simple ways of keeping track of simple rotation? 2 Answers

Limiting top down rotation amount - 2d 1 Answer

how to get object rotation? 1 Answer

Rotation Issue 0 Answers

Questions about Rotations in unity 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