Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Vector Magnitude Issue

Discussion in 'Scripting' started by ColorStorm, Oct 15, 2012.

  1. ColorStorm

    ColorStorm

    Joined:
    Jul 4, 2012
    Posts:
    28
    hey,

    When i have a vector that i want to go from say (10,0,0) to (0,0,0) I get a weird result in the magnitude when the vector gets close to 0.
    The Magnitude value jumps from 0.001 to 7.0 or 8.0 or other random values.

    What is the best method of getting a clean magnitude out? or should i rather rely on my (x,y,z) when im doing this kind of scaling ?


    Thanks
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I expect it's just printing the magnitude out in scientific notation because of the small values, so it is in fact accurate.

    --Eric
     
  3. ColorStorm

    ColorStorm

    Joined:
    Jul 4, 2012
    Posts:
    28
    Oh, i see. Thanks