Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Need litle help

Discussion in 'Scripting' started by korbljud, Apr 14, 2012.

  1. korbljud

    korbljud

    Joined:
    Oct 22, 2011
    Posts:
    11
    THIS WORK
    var tochka =Vector3(0,0.03,0);

    if (transform.position==tochka){
    audio.Play();}
    else {audio.Stop();}
    BUT I NEED THIS
    if (transform.position>=tochka){

    HOW TO DO IT?
     
    Last edited: Apr 14, 2012
  2. AlteredReality

    AlteredReality

    Joined:
    Aug 15, 2011
    Posts:
    397
    Well, first off, the reason that the existing line works is because it makes sense to check if two vectors are equal. However, it doesn't make complete sense to check it a vector is greater than or equal to another vector. What exactly are you trying to test for here? Are you trying to play a sound when this object is close to "tochka"?

    If so, you need to get the distance between the vectors and check that distance. Hopefully that helps some!