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 arvzg · Apr 26, 2014 at 09:16 AM · camerarigidbodythird-personfixedupdate

Jittery thid-person camera follow behaviour

I'm writing a controller script for a floating UFO-like ship that behaves somewhat like a helicopter, but is not affected by gravity.

The control script for the ship looks like this:

     void FixedUpdate()
     {
         vertical = Input.GetAxis("Vertical");
         horizontal = Input.GetAxis("Horizontal");
         forward = Input.GetAxis("Forward");
 
         rigidbody.rotation = Quaternion.Lerp(rigidbody.rotation, Quaternion.LookRotation(myCamera.forward, myCamera.up), Time.deltaTime * rotateSpeed);
         rigidbody.AddForce(transform.up * vertical * verticalSpeed);
         rigidbody.AddForce(transform.right * horizontal * horizontalSpeed);
         rigidbody.AddForce(transform.forward * forward * forwardSpeed);
     }

Which is simply:

  • Space/Ctrl to move the ship up and down

  • W/S to move the ship forwards and backwards

  • A/D to strafe the ship left and right.

And I have a Third person camera object (from the Sample Assets Beta package from the Asset store) following and tracking my ship.

The ship controls perfectly fine, however when viewing the game from the Game view, Forwards, Backwards, and strafing left and right seems to work fine, however rotating the ship seems to cause the ship to look 'Jittery'. As far as I can see the jitter doesn't happen on the ship, but on the camera, as viewing the ship rotate in the Scene view doesn't look like it's jittering.

As you can see, the Rotation is happening in FixedUpdate. The Third Persona camera prefab has an option to set the Update type for FixedUpdate or LateUpdate. I have chosen FixedUpdate as it seems to work better (LateUpdate has even worse jittering)

Any ideas, what can I try here to try and solve this?

Comment
Add comment · Show 1
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 arvzg · Apr 26, 2014 at 08:20 AM 0
Share

I'd also appreciate any comments for the way I've implemented the controller script - is this an O$$anonymous$$ way to do this? Is there a better way? The script does not appear in the Profiler at all when running the game, so I assume it is not not a terrible algorithm

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

20 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

Related Questions

Camera update when tracking physics controlled object 0 Answers

Camera parenting to rigidbody 0 Answers

Smart camera? 1 Answer

How do I make a third person camera toggle that doesn't snap? 0 Answers

Movement object same distance as touch movement 0 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