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
1
Question by Jeff-Kesselman · Nov 21, 2013 at 05:16 AM · vector3vector2

What is the kEpsilon field on Vectors?

I have built a run-time property inspector for a user customizable GUi system.

To my surprise an undocumented field showed up on all my Vector2 structs called "kEpsilon".

What is this, why is it undocumented, and is there a way to tell that I should be hiding this from my users? (or maybe I shouldn't?)

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 Huacanacha · Nov 21, 2013 at 06:16 AM 4
Share

Epsilon is used in floating point math to describe the smallest increment that can be represented by the floating point type around a given number (0.0f in C#, 1.0 in C++). Single floats in C# are 8 bit exponent and 23 bit mantissa, and Single.Epsilon is the magnitude of change in value incurred by changing the mantissa by 1 when the exponent is -126. It's a measure of the accuracy of the floating point representation but it only holds for floats with the same exponent, so it's not a true measure of precision.

Given that background (which you may or may not know!) I'd say that kEpsilon is some measure of the smallest representable Vector2. It is probably used in some capacity by the == operator, especially as the Unity docs for Vector2.== state that it returns true for Vectors that are very close, but not quite, equal.

avatar image Jeff-Kesselman · Nov 21, 2013 at 03:58 PM 0
Share

Thanks. Thats helpful. I remembered from math tag Epsilons have to do with $$anonymous$$ima values but thats it.

Im still trying to figure out how to hide it. k may mean its a constant so maybe I can detect it that way...

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by KrankyBoy · Oct 14, 2018 at 05:26 PM

It can be used when comparing two vectors. Since they are floats it is hard to get them exactly equal. An example would be moving an object from one position to another. You can check the distance between then objects and then if they are closer than kEpsilon then they are equal.

Comment
Add comment · 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
0

Answer by greggman · Nov 30, 2014 at 10:20 PM

It's static according to

 Vector2 v = new Vector2(2f,3f);
 System.Reflection.FieldInfo[] fields = v.GetType().GetFields();
 foreach (System.Reflection.FieldInfo info in fields) {
    Debug.Log(info.Name + (info.IsStatic ? " static " : ""));
 }
Comment
Add comment · 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

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

20 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

Related Questions

C# Convert Vector3[] to Vector2[] 3 Answers

Create custom constructors for certain Value types/Objects (Vector3, Transform, etc...) 2 Answers

[HELP] Translating vector 2 co-ordinates to real space 1 Answer

What happens when I populate a ray with a vector2? 1 Answer

how to find a point(vector2) between two points(Vector2) of a line (line renderer) 2 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