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 GimLee · Sep 23, 2015 at 11:09 PM · rigidbody2dcollidersinterpolation

What kind of interpolation for my rigidbody

At first, I used "none" interpolation, until I realized that this wont always position my object 100% accurately.

For instance, I have this character that can jump. When he lands on the ground, his position.y is not always the same. It differs about 0.005f in the y-axis. It's not much, but it's not precise, which is pretty important for my game.

Then I tried to set interpolation to extrapolation. Now the y-coordinate is correct after each jump. BUT if I do a jump and fall down to a platform at high speed, the collider will sometimes pass through the platform's collider for 1frame, and then bring it back up (as far as I understand this extrapolation). Sadly this 1frame of passing collider will cause my character to die.

Is there a way to fix both of these problems, or do I simply have to accept that one of them will occur?

I have also tried Interpolation, but it makes my character very laggy, and uncomfortable to play.

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 GimLee · Sep 23, 2015 at 11:09 PM 0
Share

This is a 2d game btw.

avatar image mujpir · Sep 24, 2015 at 07:44 AM 0
Share

Hi, Have you set your rigid body collision detection to continuous , it work better in fast speed. Then why interpolation or extrapolation ? Why not set your character y position to zero as your character lands.

1 Reply

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

Answer by MelvMay · Sep 24, 2015 at 09:07 AM

Interpolation interpolates from the old Rigidbody(2D) position to the current Rigidbody(2D) position. It modifies the transform each frame between these positions. In other words, it's based upon truth but is in the past (it's interpolating to the current position). This means the Transform changes each frame but the Rigidbody(2D) isn't changing, it's at its current position.

Next physics update, the Rigidbody(2D) position is updated and the interpolation starts again from the old to the current position.

Extrapolation works by predicting the future. It interpolates from the current Rigidbody(2D) position to a predicted future position which is calculated by taking the Rigidbody(2D) velocity and integrating it for a single physics tick.

Thus, interpolation is behind the current Rigidbody(2D) position whereas extrapolation is ahead of the current Rigidbody(2D) position.

Box2D uses a tiny gap which it considers a collision. This is to stop continuous overlaps and to provide a buffer region for continuous collision detection. The gap is supposed to be visually insignificant but numerically significant. The gap is '0.005f' which is tiny. It's 1/200th of a meter (5mm). The scale of your game is too small if 5mm is significant.

You can change this gap but it comes with a warning: http://docs.unity3d.com/ScriptReference/Physics2D-minPenetrationForPenalty.html

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 GimLee · Sep 24, 2015 at 08:47 PM 0
Share

scaling things up, has made my game run perfectly with "none" interpolation

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

29 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

Related Questions

Dynamic colliders without Rigidbodies? 0 Answers

How to rotate an RigidBody2D object to an angle and get back to the previous position in the smooth way? 1 Answer

Interpolation issue, some items not being interpolated correctly. 0 Answers

Line is not Affected by Physics 0 Answers

reversing current velocity of 2D rigidbody with button press 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