Search Unity

IsNormalized sometimes fail

Discussion in 'Physics for ECS' started by filod, Mar 18, 2020.

  1. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    224
    when i pass math.normalize() or Vector3.normalized to Math.IsNormalized, it return false, this clearly not what i want. seems Constants.eps = 1.192092896e-07F is too big?
     
  2. steveeHavok

    steveeHavok

    Joined:
    Mar 19, 2019
    Posts:
    481
    [EDIT - Never mind] Can you give me an example of the float3 you are testing with Math.IsNormalized and getting the wrong results?

    As you say, looks like we should be using a bigger Constant instead of Eps. Will fix for the next release.
     
    Last edited: Mar 19, 2020
  3. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    224
    sure, these are some examples
    upload_2020-3-20_0-46-20.png
    error vector: float3(-0.1032274f, 0f, -0.9946579f)
    error vector: float3(0.4701292f, 0f, -0.8825977f)
    error vector: float3(0.9556236f, 0f, -0.2945907f)
    error vector: float3(0.9996969f, 0f, -0.02462304f)
    error vector: float3(0.9307104f, 0f, 0.365757f)
     
  4. steveeHavok

    steveeHavok

    Joined:
    Mar 19, 2019
    Posts:
    481