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 Chris42 · Apr 10, 2011 at 10:02 PM · rigidbodyforceacceleration

Rigidbody jerky movement?

Hello all, first-time unity user and poster.

I'm working on a basic control system to fly a 3rd person spaceship around in 3D space using physics. I have a script which simply gets user input for positive or negative thrust, then multiples that by the direction and an acceleration multiplier. There's a bunch of other code, but slowly debugging by turning things off showed that neither mouselook aiming nor top speed limiting changed anything.

> forceToAdd = Vector3.forward *
> CheckForThrust()*accelMult;   
>   rb.AddRelativeForce (forceToAdd);

Checkforthrust:

>  function CheckForThrust(){
>       // If accelerate key is pressed, set accel to increase to 1. if
> backwards, interpolate to -1. If
> nothing, head to 0
>       
>       if (Input.GetKey("q")) {
>           engineStatus = Mathf.Lerp(engineStatus,1,0.01);
>       } else if (Input.GetKey("e")) {
>           engineStatus = Mathf.Lerp(engineStatus,-1,0.1);
>       } else {
>           engineStatus = Mathf.Lerp(engineStatus,0,0.01);
>       }
>     
>       Mathf.Clamp(engineStatus,-1,1);
>       return engineStatus;
>     }

When acceleration starts, everything's fine. But when I get past a certain velocity threshold the ship starts jittering like mad. It's not related to application of force, because if I ease up on the thrust and stop accelerating, the jittering remains. I tried setting the rigidbody to Interpolate and Extrapolate. Extrapolate seemed to improve things a bit, but not much. I even tried applying the force inside Update() instead of FixedUpdate() even though you're not supposed to, that just made it worse.

Any ideas?

Comment
Add comment · Show 3
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 Jesse Anders · Apr 10, 2011 at 10:34 PM 0
Share

Are you using some sort of 'follow camera' script by any chance?

avatar image Parthon · Apr 11, 2011 at 12:29 AM 0
Share

Need more information. Did you try and change the function? Are you debug logging values to see if there's a pattern of differences? Did you remove the function and just test raw acceleration? Is the problem in the input code or somewhere else in the rigidbody code?

avatar image Chris42 · Apr 13, 2011 at 07:30 AM 0
Share

I'm using a camera following script, yes. it still occurred if I disable the script.

I did figure it out though! what was happening was that force was being applied between each solver step due to the input code being badly designed. redesigning the input and slightly increasing solver steps fixed the problem

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

No one has followed this question yet.

Related Questions

How to change velocity of object which move by Rigidbody. 1 Answer

About Forces and Time.deltaTime 3 Answers

Question about addForce() 1 Answer

Reading the forces applied on a freezed rigidbody(solved) 1 Answer

Unity First person controller force and mass 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