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 Feref2 · Dec 07, 2018 at 09:16 PM · lerppositioningdeltatimestutter

How to fix stuttering when a gameObject´s position should be at a exact place each frame?

So am editing the question to be more specific. This is what I want to prevent: alt text

The object is going through, and I can´t use the physics system to prevent it since everything has fixed positions and nothing is affected by physics. So I´ve already solved this, but not very well. Because the objects are moving fast (or skipping positions in space) the collisions are detected late. I was asking if there was a way of lerping in between frames in order to not skip positions and be accurate, because this only works if it´s moving slow.

So there are 3 steps in this process: get the currentTotalX (sum of grounds width) += 0.1f (this number changes depending on how much should increase/decrease); Then instantly setting their scales to this float scaleX = (currentTotalX - GetSumGrounds(groundBases) - cornerX) / sumPercentageGround * percentageGround[i] / originalGrounds[i]; It´s a little confusing, but it´s basically getting their scales based on percentage and the currentTotalX I mentioned. When that value decreases, so does this. Then just instantly positionate them to be aligned and look like a single ground.

So here is the issue. The scales, currentTotalX and the positions are directly set instead of lerping. And because the positions depend on the scale and the scale on the currentTotalX I don´t know what to do. I tried lerping the scales and the currentTotalX, but nothing worked.

captura-de-pantalla-36.png (379.1 kB)
Comment
Add comment · Show 8
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 Vega4Life · Dec 08, 2018 at 11:21 PM 0
Share

So the blue box is moving right, it hits the red box... goes through it, but you want the blue box to stop and align the edges with the red box? Does those boxes have triggers on them or anything? Is the movement a fixed position you are going to? Or you just move it till it contacts something?

avatar image Feref2 Vega4Life · Dec 09, 2018 at 12:45 AM 0
Share

Yes, it´s supposed to stop moving when hits the red box. When it collides, the white ground below clamps its scale, so the blue grounds around them stop moving (since their positions are fixed to be always at their sides). They don´t have triggers: I know that they are colliding because of the blue and green raycasts. Like I said, the scales of the white grounds instantly change depending on the currentTotalX, but if they scale slowly this doesn´t happen.

avatar image Vega4Life Feref2 · Dec 09, 2018 at 01:24 AM 0
Share

I have an interesting idea using a trigger. I find it a little much to raycast out the sides. Let me know if you want to see it.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Vega4Life · Dec 07, 2018 at 09:19 PM

This is an oldie, but has good information. It should satisfy any lerping needs.


https://chicounity3d.wordpress.com/2014/05/23/how-to-lerp-like-a-pro/


Comment
Add comment · Show 6 · 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 Feref2 · Dec 07, 2018 at 11:04 PM 0
Share

Sorry, I don´t know if I read something wrong or if that site doesn´t really answer the question; but I think it doesn´t even mention lerping between frames.

avatar image Vega4Life Feref2 · Dec 07, 2018 at 11:11 PM 0
Share

I am not sure what you mean by lerping between a frame... that's not a thing.

avatar image Feref2 Vega4Life · Dec 08, 2018 at 12:21 AM 0
Share

I mean moving from the position of frame 1 to the position of frame 2 at the deltaTime of frame 2. But because I don´t know which will be the next position, it´s more like directly setting the position of this frame, but moving smoothly to it from previous position. $$anonymous$$aking an instant change in position, but smoothly. I know that an instant change by definition doesn´t take time, but that was the reason I wanted to lerp in between frames.

Show more comments

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

98 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

Related Questions

Time.deltaTime making color lerp appear fast, but won't reach 1 1 Answer

Jump with mathf.lerp problem 2 Answers

Beginner question about using deltaTime 1 Answer

Camera Stutter on RayCast Collision Problem 0 Answers

Lerp stopping/not working? 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