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 bwaite87 · Jun 02, 2019 at 02:42 PM · rigidbodyjitterinterpolation

RB Interpolation

I'm a little confused, because right now my character is shooting a projectile with a non-kinematic RB, it's movement is shown below:

  private void FixedUpdate()
     {
        rb.velocity = shootDirection * speed * Time.deltaTime;
     }

yet for some reason I'm still seeing a pretty bad jitter on the projectile. The only way I've found to fix this is to set the RB Interpolation on the projectile Gameobject to "Interpolate" - but per the Unity documentation this is really only recommended for a character gameobject.

I feel as though I've done something wrong if I have to set it's Interpolation to "Interpolate". Does using Interpolate cost much performance-wise? FYI - my cameraFollow is being updated in the LaterUpdate() function.

Let me know if there's any more info you need. I'm just confused because I've never had to play around with the interpolation before to get smooth results.

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 Hellium · Jun 02, 2019 at 03:51 PM 1
Share

The velocity of an entity is the deltaDistance / deltaTime, so remove the * Time.deltaTime when computing the velocity.

avatar image bwaite87 Hellium · Jun 02, 2019 at 06:57 PM 0
Share

had no idea. Thanks man.

1 Reply

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

Answer by Epsilon_Delta · Jun 02, 2019 at 04:09 PM

I think the problem might be that you set velocity every fixed update (at least in provided code) and you multiply it with Time.deltaTime which is a different number every time. It is impossible to interpolate trajectory in such implementation. Instead, you probably want to set velocity just once and do not multiply it with Time.deltaTime (so you will need to decrease the "speed" value probably). Now you you may or may not need to use interpolation, try both and see what looks better.

You can set velocity in Start() method in the script attached to the projectile or anywhere else, you don't need to set velocity in FixedUpdate(). Note that now, when you set velocity only once, your rigidbody drag will slow the projectile down, so make sure it is zero or small enough.

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 bwaite87 · Jun 02, 2019 at 06:57 PM 0
Share

This is excellent info, thanks so much! I had no idea you could set it only once. This should definitely be better performance-wise.

See g_raver for official answer. The option to convert his answer as the official answer isn't working right now for some reason

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

149 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

Related Questions

Get Interpolated rigidbody velocity 1 Answer

Collision Detection on Rigidbody with Interpolation and Rigidbody with Extrapolation is different 0 Answers

Weird jitter on Android using Character Controller 0 Answers

How to move a kinematic rigidbody smoothly? 3 Answers

Jittery Rigidbody 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