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
2
Question by 24adithya · Jun 17, 2012 at 12:19 PM · lerp

Usage of InverseLerp

Hi,

Can anyone explain how and when does one use InverseLerp ?? I understood Lerp and its usage but i am not able to understand when should one use InverseLerp ??

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 asafsitner · Jun 17, 2012 at 12:24 PM 0
Share

I used it once for predicting complex rotations in a multiplayer game. The idea was to find out how much I'd have to lerp the remote player on the lovcal machine to arrive at the received network state, then lerp it by double that amount to achieve near-precise rotation prediction.

It was crude, but it worked.

2 Replies

· Add your reply
  • Sort: 
avatar image
7

Answer by Wolfram · Jun 17, 2012 at 08:00 PM

I was a bit confused looking at the docs just now, because the explanation is rather terse. But it actually does exactly what it suggests - instead of returning a value between A and B correspondin to the lerping parameter, it returns the lerping parameter if you feed it the value between A and B.

I guess you could use it for a Slider value or something similar: if you know the lowest possible point of your slider is minPixels, and the highest possible point is maxPixels, the value returned by

 Mathf.InverseLerp(minPixels, maxPixels, currentPixelPositionOfSlider);

is just the "percentage" (in the range between 0..1) of how much your slider is "full".

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 Xnerdz · Apr 22, 2014 at 06:16 PM 1
Share

So to clarify: - Lerp funciton takes a percentage and returns the value in range - InverseLerp function takes a value in range and returns the percentage

avatar image
0

Answer by a67_nk · Jun 22, 2017 at 12:19 PM

I know it's not the right place to ask but can you please explain me what is mathf.lerp and how does it work, plz

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 Wolfram · Jun 22, 2017 at 01:29 PM 0
Share

http://answers.unity3d.com/questions/237294/how-the-heck-does-mathflerp-work.html

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to use Mathf.Lerp and Mathf.InverseLerp??? 1 Answer

Not Sure How to Get Around this Problem 1 Answer

changes to colour alpha affect RGB values, but not in the same way 1 Answer

Smoothing end of a lerp 2 Answers

Lerp color of verts with position bigger than 1 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